Linked by Hadrien Grasland on Fri 27th May 2011 11:34 UTC
General Development After having an interesting discussion with Brendan on the topic of deadlocks in threaded and asynchronous event handling systems (see the comments on this blog post), I just had something to ask to the developers on OSnews: could you live without blocking API calls? Could you work with APIs where lengthy tasks like writing to a file, sending a signal, doing network I/O, etc is done in a nonblocking fashion, with only callbacks as a mechanism to return results and notify your software when an operation is done?
Permalink for comment 474827
To read all comments associated with this story, please click here.
Comment by foobaz
by foobaz on Fri 27th May 2011 15:25 UTC
Member since:

I often prefer to use blocking calls on a background thread. For example, if I have a lot of operations to perform on a slow resource like disk or network. It's easier to spin a new thread that pulls these requests out of a queue while other threads enqueue them. For a file or a socket you can only write from a single thread at a time, and order matters. Using a blocking call on a background thread makes it easy to ensure only one write is occurring at a time.

Reply Score: 2