#include <asyncio.h>
Inheritance diagram for AsyncIO_Shared_State:

Simple wrapper around POSIX.1b asynchronous I/O (as documented in GNU Info under Libc -> Low-Level I/O -> Asynchronous I/O). This should be portable across most Unix-like systems. Win32 has its own async I/O facilities which are similar to these (see Jeffrey Richter's "Advanced Windows" for details).
An AsyncIO object represents I/O on a particular file descriptor. The read() and write() methods attempt to initiate I/O, returning error status if unsuccessful. If they succeed then I/O is underway and you can't touch the buffer until completion. You can either poll by calling is_complete(), or (better) do everything else you need to do then call wait_for_completion() which will block in a multiprocessing-friendly way. Even if is_complete() has returned true you must still call wait_for_completion() to determine the completion status of the operation.
WARNING: Although you can instantiate multiple AsyncIO objects, only one I/O op can be in progress at once within a process. This is because we get notified of completion by a signal, whose handler has to be a non-member function. The handler could be extended to inspect a list of (signal, request) pairs to determine which object's request has completed, but I haven't done this since protecting such a list from race conditions is probably non-trivial and I don't need the capability. Note the use of class AsyncIO_Shared_State to clarify the distinction between shared and per-object state.
Modifications
06-Nov-00 SJB Initial version
13-Dec-00 SJB Use SIGIO as default completion signal
Fix up wait_for_completion, add suspend flag
Definition at line 55 of file asyncio.h.
Static Protected Member Functions | |
| static void | signal_handler (int) |
Static Protected Attributes | |
| static volatile vcl_sig_atomic_t | complete |
| Initialise shared state to "no operation in progress". | |
| void AsyncIO_Shared_State::signal_handler | ( | int | ) | [static, protected] |
Definition at line 15 of file asyncio.cxx.
volatile sig_atomic_t AsyncIO_Shared_State::complete [static, protected] |
1.5.1