Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about condition-variable

Read more about condition-variable

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - condition-variable

How to wake up multiple threads using condition variable

I want to run multiple threads every 100ms. In order to achieve that I thought of introducing std::mutex and std::condition_variable. The problem I'm facing is on what basis the threads should go into...
test-img

Harry

c++

mutex

condition-variable

Votes: 0

Answers: 1

Latest Answer

As you mentioned about spurious wake-ups, thus my solution is to use another variable flag to let the waked thread can distinguish the correct notified case and spurious waked up case. So actually, wh...
test-img

user8510613

`std::condition_var::notify_all` deadlocks

I have cpp code where one thread produces, pushing data into a queue and another consumes it before passing it to other libraries for processing. std::mutex lock; std::condition_variable new_data; std...
test-img

Nescio

c++

multithreading

c++11

condition-variable

Votes: 0

Answers: 2

Latest Answer

I also encountered the same problem. After doing a few experiments, I found that if the notify_all starts to work after the condition_variable destroying, the notify_all will deadlocks. See the code b...
test-img

张顺意

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved