Hello,
I want to convert some existing code to using the madKernel interfaces. In one place I use WaitForMultipleObjects to wait on a semaphore and an event. I was thinking I would use
function WaitFor (const objects : array of IBasic;
waitAll : boolean = false;
milliseconds : cardinal = INFINITE;
handleMessages : boolean = true;
msgs : TWaitForMessages = [];
alertable : boolean = false ) : integer; overload;
but it seems there is no ISemaphore.
Is there a reason to not have an ISemaphore?
Should I still use WaitForMultipleObjects and feed in the handle from the IEvent?
thanks
ISemaphore missing in action
You're right that there's no ISemaphore. Maybe I should add that. Anyway, you could use "yourSemaphore := madKernel.Handle(yourSemaphoreHandle, false)" to convert your manually created semaphore handle into a madKernel compatible "IHandle" instance. After having done that you can use "WaitFor([yourEvent, yourSemaphore])". Of course you can also use WaitForMultipleObjects and feed in "yourEvent.Handle.Handle" (the first "Handle" returns an IHandle instance, then calling "IHandle.Handle" finally returns a standard win32 handle dword for use with WaitForMultipleObjects).
-
- Posts: 4
- Joined: Tue Jun 15, 2004 11:17 pm