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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:21:56+00:00 2026-05-27T05:21:56+00:00

According to Open Group Base Specifications Issue 7, IEEE Std 1003.1-2008, a single condition

  • 0

According to Open Group Base Specifications Issue 7, IEEE Std 1003.1-2008,
a single condition variable (pthread_cond_t) shouldn’t be used along different mutexes (pthread_mutex_t) in pthread_cond_wait() while at least one thread is waiting on this condition variable: eg. pthread_cond_wait(&cond1, &mutex1) can’t be used in parallel with pthread_cond_wait(&cond1, &mutex2): this behavor is unspecified.

But it is not specified if using a single mutex with multiple condition variables is allowed, eg: pthread_cond_wait(&cond1, &mutex1) in parallel with pthread_cond_wait(&cond2, &mutex1).

I think such construction should be avoided to allow safe (two way)

dynamic binding […] formed between that mutex and condition variable

Could someone comment on this issue ?

  • 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-27T05:21:57+00:00Added an answer on May 27, 2026 at 5:21 am

    It’s perfectly fine to use the same mutex for multiple condition variables, just not the reverse.

    One way to think about this is: Part of the contract of pthread_cond_wait is that when the calling thread awakens from its wait, it will own the locked mutex, which makes sense only if there’s just one mutex associated with the condition variable.

    To see why you might want to do this, imagine a design where you have a number of global counters protected by a single mutex (user count, # of open files, etc.). You could then quite reasonably have multiple condition variables you might want to wait on, all associated with that single mutex:

    pthread_cond_wait(&usercount_lessthan_limit_cond, &global_mutex);
    ...
    pthread_cond_wait(&openfilecount_lessthan_limit_cond, &global_mutex);
    ...etc...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html According to that article STL isn't suited for game-development. What are your thoughts
I've been looking for PHP, SQL open scripts on retrieving data from DB according
I have problem with keeping the active according open after the post-back of ASP.NET
According to ADC documentation: You can access Open Firmware this by holding down Command-Option-O-F
According to: http://intendance.com/2011/03/31/enterprise-content-management-open-source-squiz-matrix/ They have stated: Most other open source content management systems options
I'd like to open the iphone calendar app programmatically from within my app. According
According to this post a typical firefox user has 2-3 tabs open. How can
According to Pydocs, fp = file('blah.xml', 'w+b') or fp = file('blah.xml', 'wb') means open
I have this open transaction, according to DBCC OPENTRAN : Oldest active transaction: SPID
We are integrating documentation authored according to DITA. The DITA Open Toolkit processes all

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.