http://qs321.pair.com?node_id=11128684


in reply to Semaphore puzzle

Thanks all. Just getting others' suggestions is often enough to trigger thoughts on different ways to achieve things. A couple of details that I hadn't included in my original post (I thought they'd add additional unnecessary clutter) is that
(a) I send a request for the files - the names of my request and the returned files are the same other than the last letter.
(b) The semaphore key I use is a hash of the file name(excluding the last letter) so that I can have multiple streams running together without interaction. It's clear that the big delay here is the time it takes to create the semaphore in the first place, so, my plan today is to use my requesting process to create and initialize the semaphore but not actually use it - that'll be left to the receiving processes. Hopefully the turn around time between request and response is enough for the semaphore to come into existence. Watch this space...