News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

WaitForSingleObject / Create Event

Started by AgentSmithers, July 01, 2009, 02:16:10 AM

Previous topic - Next topic

AgentSmithers


invoke CreateEvent,NULL,FALSE,FALSE,NULL

;Threads are created here! 10 of them!

invoke SetEvent,hEventStart
invoke SetEvent,hEventStart
invoke SetEvent,hEventStart
invoke SetEvent,hEventStart
invoke SetEvent,hEventStart
invoke SetEvent,hEventStart
invoke SetEvent,hEventStart
invoke SetEvent,hEventStart
invoke SetEvent,hEventStart
invoke SetEvent,hEventStart


ThreadProcOne PROC Param:DWORD

            invoke WriteConsoleA, STDHandle, ADDR StartOfMain, LENGTHOF StartOfMain, ecx, 0 ;Uses 2Byte Tchar's
           
            invoke WaitForSingleObject,hEventStart,INFINITE

            invoke WriteConsoleA, STDHandle, ADDR RecvEvent, LENGTHOF RecvEvent, ecx, 0 ;Uses 2Byte Tchar's
            ret


Is it normal that I must call Invoke once for each thread, It appears that if I call it once it only triggers one thread that is Sync waiting with 9 others for the same event, Why is it not triggering the event on all threads?

-Agent

Jibz

http://msdn.microsoft.com/en-us/library/ms682396(VS.85).aspx

QuotebManualReset [in]

    If this parameter is TRUE, the function creates a manual-reset event object, which requires the use of the ResetEvent function to set the event state to nonsignaled. If this parameter is FALSE, the function creates an auto-reset event object, and system automatically resets the event state to nonsignaled after a single waiting thread has been released.

AgentSmithers

Thanks! I knew I over looked something! I was looking for RaiseEvent I dident see it in the Synchronization Functions list =D