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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:24:51+00:00 2026-05-24T09:24:51+00:00

I am in a soup. The idea may be bad but i do need

  • 0

I am in a soup. The idea may be bad but i do need a solution.

  • I have two condition variable, say A and B.

  • Threads 1, 2 and 3 are waiting on A. Thread 4 is waiting on B.

  • B will be pthread_cond-signal() by thread 2, that is thread 4 will be
    signaled to wake up by thread 2.

Now, I have another thread 5 which pthread_cond_broadcasts() on condition variable A. I need all threads 1, 2 and 3 to wake up before thread 4 wakes up. That is say if thread 2 wakes up and signals on B thread 4 may wake up before thread 3 does, which is not what i want.

Any pointers will be highly appreciated.

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-05-24T09:24:52+00:00Added an answer on May 24, 2026 at 9:24 am

    Use a semaphore: have each of threads 1-3 post the semaphore, and have thread 4 wait on the semaphore 3 times instead of on a condition variable.

    You’ll want to use sem_init(3) or sem_open(3) to create the semaphore, sem_post(3) to post the semaphore, sem_wait(3) to wait on the semaphore, and then either sem_destroy(3) (if created with sem_init) or sem_close(3) and sem_unlink(3) (if created with sem_open) to destroy the semaphore.

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

Sidebar

Related Questions

I have an array of ingredients for soup as strings. These ingredients are also
I am learning Python - Beautiful Soup by trying to scrape data. I have
I am using Beautiful Soup 3.2 on python 2.7.1 here. I have recently been
I'm using beautiful soup (in Python). I have such hidden input object: <input type=hidden
Currently I have code that does something like this: soup = BeautifulSoup(value) for tag
I'd like to do a very simple replacement using Beautiful Soup. Let's say I
Does anyone have some sample code that illustrates how to use Python's Beautiful Soup
I have this code to extract title: soup = BeautifulSoup.BeautifulSoup(urllib.urlopen(url)) title = str(soup.html.head.title.string).lstrip(\r\n).rstrip(\r\n) Some
I have a polygon soup of triangles that I would like to construct a
I am using beautiful soup and I am writing a crawler and have the

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.