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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:03:32+00:00 2026-05-12T08:03:32+00:00

I have a desire for POSIX style condition variables on Win32. I have some

  • 0

I have a desire for POSIX style condition variables on Win32. I have some code that needs to run on XP, so I can’t use Vista/Server 2008’s CONDITION_VARIABLE.

It makes use a of a pseudo condition variable class currently, which is based on leaving the critical section and signaling an auto reset event for signaling / waking. For waiting on the condition variable, it leaves the critical section, WaitForSingleObjects on the event, and then reenters the critical section. This is mostly fine, but it doesn’t support broadcast, and may have other issues with regard to fairness, which I don’t care too much about.

We do use boost, so I know know I could use boost threads or pthreads-win32, which support condition variables, but ideally I would like the interface to be such that I can drop in the Microsoft implementation when/if it becomes possible to use it directly. I have seen Strategies for Implenting POSIX Condition Variables on Win32, but the “best” (most correct) solution uses a Mutex and not a CRITICAL_SECTION. There is a sketch of an implementation with a CRITICAL_SECTION in the second part, but it is not complete, and the other solutions with CRITICAL_SECTIONs concern me due to the concerns outlined for them in the article.

In short, how do I implement a correct, not necessarily fair (but that would be nice), condition variable on win32 for critical sections such that I can drop in Microsoft’s implementation when it becomes available to me?

  • 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-12T08:03:33+00:00Added an answer on May 12, 2026 at 8:03 am

    The papers to which you refer were written by colleagues of mine as an outgrowth of our work on the ACE C++ framework and its OS wrapper facades. As mentioned in my bio, “I don’t do Windows”, but I still actively work on ACE, and I just took a look, and it appears that the condition variable implementation for Win32 uses CRITICAL_SECTION (on initial inspection it looks like it’s just using a mutex, but if you dig deeper you’ll find that there’s a layer below in which a mutex is defined as CRITICAL_SECTION on windows platforms).

    FYI, in order to insure that the code hadn’t been modified to use the new Vista APIs, the code base I checked is actually a branch off the 1.5 line.

    Presuming you just want a C API for condition variables, and not C++ wrappers around it, all of this should be contained in one set of files: ace/OS_NS_Thread.{h,inl,cpp} The license on ACE is very generous, and not GPL, so you can lift code from there into proprietary code base without fearing “GPL contamination”.

    You can obtain releases of ACE at http://download.dre.vanderbilt.edu/; the version I inspected is a commercially-supported release derived from ACE 5.5.2, maintained by OCI and available for download at http://www.theaceorb.com/downloads/1.5a/index.html.

    In the interest of full disclosure, I’ve been a longtime user/contributor/maintainer to ACE, worked on that research staff for awhile, and am now an employee of OCI. I don’t think that changes the utility/applicability of this code for you, nor do any of the aforementioned entities derive revenue from you lifting code from the source.

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

Sidebar

Related Questions

I use a cluster of about 30 machines that have all recently been reconfigured
Due to a client's desire to have URLs that defy Cake logic I have
I have a local development box that I code on before I transfer my
I came upon some code in an application I'm supposed to update that defines
We're trying to learn to use T4 Templates. I have a desire to use
Often times I have a desire to create variables scoped to an if statement.
I have several excel workbooks that each have a desire spreadsheet that will continually
If you use perforce remotely and desire to have the awesome speed of git
I have two device: HTC Desire with Android 2.2 Froyo and HTC Evo 3D
We have a client who desires some extremely long pages. Say 4000px plus. They

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.