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 787137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:09:18+00:00 2026-05-14T21:09:18+00:00

I am using boost::thread to process messages in a queue. When a first message

  • 0

I am using boost::thread to process messages in a queue.
When a first message comes I start a message processing thread.
When a second message comes I check if the message processing thread is done.

if it is done I start a new one
if it is not done I don nothing.

How do I know if the thread is done ? I tried with joinable() but it is not working, as when the thread is done, it is still joinable.

I also tried to interrupt the process at once, and add an interruption point at the end of my thread, but it did not work.

Thanks

EDIT :

I would like to have my thread sleep for an undetermined time, and wake up when a signal is triggered.

The mean to do it is boost::condition_variable

  • 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-05-14T21:09:18+00:00Added an answer on May 14, 2026 at 9:09 pm

    Spawning a new thread for each incoming message is very inefficient. You should check out the Thread pool pattern.

    EDIT:

    Sorry, jules, I misread your question. I recommend you take a look at the producer-consumer pattern. Check out this article on how to roll your own blocking queue using boost condition variables. Intel’s Thread Building Blocks also has a blocking queue implementation.

    Check out this SO question about existing lock-free queue implementations.

    Hope this helps.

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

Sidebar

Ask A Question

Stats

  • Questions 513k
  • Answers 513k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There isn't a regular expression for HQL because HQL isn't… May 16, 2026 at 6:02 pm
  • Editorial Team
    Editorial Team added an answer It is a "add-in" framework which is designed to let… May 16, 2026 at 6:02 pm
  • Editorial Team
    Editorial Team added an answer Sorry, that isn't possible May 16, 2026 at 6:02 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm want to check for incoming data packages on the serial port, using boost.asio
I am experiencing a crash while using the Boost.Spirit and Boost.Thread libraries in my
I'm writing an MPI program (Visual Studio 2k8 + MSMPI) that uses Boost::thread to
on linux, gcc 4.3, compiling a class with boost::thread implementation and mutexes / condition
I'm using Boost.Range to pass around some data and a container class for this
i have written a simple console application just to try boost::thread, i am a
I'm using boost::iostreams::gzip_decompressor with boost::iostreams::filterimg_streambuf to read gzip files. some of my files have
I am using boost serialization on windows, and I wanted to test my code
I've got my own DLL which is being injected into another process. From the
I've been playing around with boost threads today as a learning exercise, and I've

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.