waitformultipleobjects

Listening on a comm port and stdin in Win32

I'm trying to write a small utility that maps stdin/stdout to a serial port (a command line terminal emulator of sorts) using the Win32 APIs. I have the following code, which I think ought to work, but it doesn't appear to be receiving notifications properly from the serial port: HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE); HANDLE hC...

CEvent-like behaviour with Boost.Thread

Problem in words: For my application, I have a class that reads from a serial port. It uses Windows primitives for COM port handling and had a thread for asynchronous reading. I'm trying to convert this away from Windows primitives using Boost libraries such as Boost.Asio and Boost.Thread. In the Windows port, my IO thread had severa...

How port WaitForMultipleObjects to Java?

Hello fellows! I have some code in C++ for Windows and I intend to port it to Java. But unfortunately it is not so easy as I thought. Could someone help me, please? Please, take a look at algorithm: HANDLE hExitEvent; HANDLE hDataAvailabeEvent; while(true) { WaitForMultipleObjects(); if (hExitEvent is set) break; if (hDataA...

Does Poco C++ library have a cross platform WaitForMultipleObjects() analog?

Based on this question I am going to use Poco::NamedEvent, but I need to wait for multiple events (like win32 WaitForMultipleObjects() Is there such a thing in poco? (searching the docs doesn't yield much but perhaps I am not using the right searches) ...

Chat server design of the "main" loop

Hey, I am writing on a small tcp chat server, but I am encountering some problems I can´t figure out how to solve "elegantly". Below is the code for my main loop: it does: 1.Initiates a vector with the basic event, which is flagged, when a new tcp connection is made. 2. gets this connection and pushes it back into a vector, too. Then w...

WaitForMultipleObjects and several SetEvent()'s

I process some event, signaled by WFMO, and at this time it's signaled more N times. Would WFMO return once or N times? ...

MsgWaitForMultipleObjects sometimes returns WAIT_FAILED with no GetLastError value

I have a thread that creates COM objects that require a single threaded apartment. Originally, this thread's main function put it into a WaitForMultipleObjects loop. Evidently this is a problem, because it prevents the COM message pump from doing it's job. I replaced this with MsgWaitForMultipleObjects as a solution, but now I'm runnin...