Ok, after several long distractions (games, other projects, vacation), I'm finally back to writing my asynchronous winsock wrapper. Originally, I had a thread waiting on the events and extracting the network notifications to a queue for later processing by main() (one call to 'execQueuedEvents()' executes preset callbacks set by the user). However, coming back with a fresh mind, it has suddenly occurred to me that I could just have a function that polls the events from main() ('while(WaitForMultipleObjects..)'). By my reasoning, this would eliminate the need for a separate thread - and therefore the thread-synchronization problems associated with it. After doing a profiling test I determined that WaitForMultipleObjects does not cause any significant delay when used for polling either; so I'm in a dilemma: Should I redesign the wrapper without the thread, or is there some advantage to using one? I currently see no reason not to get rid of it, but all the sites I've seen use a thread to handle the network events.
Does anyone have any comments or suggestions about this?