SetEvent()

This is a discussion on SetEvent() within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I am new to Windows Programming. Can anyone tell me whether the calling thread is blocked on SetEvent() function? ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    2

    SetEvent()

    Hi,

    I am new to Windows Programming. Can anyone tell me whether the calling thread is blocked on SetEvent() function? Or atleast is it ensured that the thread(s) waiting on the Event set by Set Event() function are scheduled ahead of the thread calling the SetEvent() function?

    Thanks,
    Abhijit

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,471
    the calling thread is blocked on SetEvent
    No it is not, why should it be?

    Or atleast is it ensured that the thread(s) waiting on the Event set by Set Event() function are scheduled ahead of the thread calling the SetEvent() function?
    With multiple threads waiting for the same event - behavior will be different for Manual reset and automatic reset events... (all or only one random thread will be resumed)

    All resumed threads will be scheduled in the regular mode... And no one will give you a guarantee that it (they) will be scheduled on the same CPU as the thread calling SetEvent
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    2
    Thanks for the info.

    I agree with you for multiple processor environment. What about uni processor environment?

  4. #4
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,471
    What about uni processor environment?
    What about it? All resumed threads are scheduled according to the scheduler model of the Windows...
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,428
    Events are not meant for thread synchronization...
    For that you need critical sections, semaphores or mutexes.
    Events are used to signal when an event occurs.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SetEvent() and ResetEvent()?
    By cpjust in forum Windows Programming
    Replies: 50
    Last Post: 03-26-2008, 09:07 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21