Synchronization and Device I/O

Windows CE supports both synchronous and asynchronous I/O operations on files and serial communications devices. The WriteFile, ReadFile, and WaitCommEvent functions can be performed either synchronously or asynchronously.

When a function is executed synchronously, it does not return until the operation has been completed. This means that the execution of the calling thread can be blocked for an indefinite period while it waits for a time-consuming operation to finish. Functions called for overlapped operation can return immediately, even though the operation has not been completed. This enables a time-consuming I/O operation to be executed in the background while the calling thread is free to perform other tasks. For example, a single thread can perform simultaneous I/O operations on different handles, or even simultaneous read-and-write operations on the same handle.

Windows CE does not support the overlapped I/O features of Windows NT. The lpOverlapped parameter to ReadFile or WriteFile must be NULL. Therefore, Windows CE cannot signal the event passed in when the I/O operation is completed. However, Windows CE does support simultaneous synchronous or asynchronous calls to ReadFile or WriteFile made by separate threads that are overlapped in time; this is not supported in Windows NT.