What you are talking about is asynchronous data processing.
To implement this you need to use ReadFile in asynchronous (OVERLAPPED) mode.
1. Create an event.
2. Create an OVERLAPPED structure containing a handle to this event
3. Pass this to your ReadFile function
4. In a separate thread wait on the event handle. When the event is signaled process the data that has arrived.
5. Use GetOverlappedResult() to find out how many bytes have arrived.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms683209(v=vs.85).aspx[
^]
This may be helpful
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365683(v=vs.85).aspx[
^]