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

  • SEARCH
  • Home
  • 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 8686225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:47:32+00:00 2026-06-12T22:47:32+00:00

My program , in C++, has a thread that insets data to a buffer,

  • 0

My program , in C++, has a thread that insets data to a buffer, and another thead that reads this data.
when there is no more data to read, I wan to wait till the other thread inserts new data.
I mostly work on linux, but I dont know how to do it in Windows.
the most similar thing that I’ve found is the “WaitForSingleObject” function, but it’s not exactly what I need since I dont want to wail till the thread that inserts data is dead.

can someone please direct me to a place I can read about this more?
thanks!

  • 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-12T22:47:33+00:00Added an answer on June 12, 2026 at 10:47 pm

    You can use WaitForSingleObject with timeout. Your thread that inserts data might signal to your reader thread that no more data is available. Here is some good reading on this subject:

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms686915%28v=vs.85%29.aspx

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

Sidebar

Related Questions

I'm trying to delete a file that another thread within my program has previously
My program has one background thread that fills and swaps the back buffer of
My program has two threads: Main execution thread that handles user input and queues
My program has to use certain files that reside in another directory. Right now
In my program there is one thread (receiving thread) that is responsible for receiving
This program has 2 classes with a main method and is supposed to read
I have a program that has 2 threads running, and each thread has its
My program has a main thread that takes command input from a user. Separately,
There is this weird bug in my program that I'm trying to fix, but
My program has 100 threads. Every single thread does this: 1) if arrayList is

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.