Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7982429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:40:44+00:00 2026-06-04T10:40:44+00:00

I am using WaitForSingleObject() function for implementing wait in my program. WaitForSingleObject(eventToBeSigaled, timeOut); all

  • 0

I am using WaitForSingleObject() function for implementing wait in my program.

WaitForSingleObject(eventToBeSigaled, timeOut);

all of us know that this function wait for the event to be signaled for the specified amount of time.

But I want to know that what happens when the event has already singled before entering to this call, at that time is the wait will fail(WAIT_FAILED)? Please answer this with proper reason. I want to know this little deeper.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:40:45+00:00Added an answer on June 4, 2026 at 10:40 am

    Answer to your first question: if the event is already signaled, your Wait() would return immediately returning WAIT_OBJECT_0.

    Second question: One of the circumstances WAIT_FAILED is returned is if the event handle is closed when Wait() is called. In this case, the OS scheduler won’t be able to process the Wait() call and hence returns WAIT_FAILED.

    Note that at the end of the day, the Wait() functions are a means for the user threads to pass the CPU back to the OS until a certain condition is met. Depending on your needs, you use one of the OS primitives as a condition (semaphore, mutex, events, etc). The OS scheduler in turn checks this condition to determine if your worker thread should be given CPU time slice thereby ensuring that all threads (and hence all processes) get a fair share of the system resources.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I wait on a non-signaled Event using the WaitForSingleObject function, I find that
I'm using the ShellExecuteEx function in a C++ program to launch an Uninstall.lnk file.
I am using WINAPI for a program that I am writing. The program has
At the moment, I am using WaitForSingleObject to wait for a sub-task thread to
I'm trying to watch a directory for changes using the FindFirstChangeNotification function. This works
Using the WaitForSingleObject Function. If the function is called and times out, does it
Using Yii, I want to delete all the rows that are not from today.
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
Using Nunit, I want to be able to write a test fixture that will
Using Flex 3, I would like to take an image snapshot such as this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.