This is the mail archive of the mailing list for the pthreas-win32 project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New pthreads-w32 releases available: versions 2.3.0 and 1.7.0

On 4/13/05, Ross Johnson <> wrote:
> [...]
> So I'm now hoping that someone might take a look and point out the error
> and also, that the error is retrievable
> [...]

Yeah, I still have 'take another crack at call_once' on my list of things to do.

If we end up needing to mess with thread priorities anyhow (although
only in the cancel case), it might be easiest to just boost everyone's
priority right away, which was my first version (Alex might remember
seeing it on comp.programming.threads).  Something like (from memory,
and with interlocks, etc, left out):

oldpriority = GetPriority();
SetPriority(MAX); // must do this before checking initted - otherwise
could be too late!

if (!started++)
   initted = true;
     SetPriority(oldPriority); // note that oldPriority may
coincidentally be MAX
     while( !initted)

Very much like the old original version, but since we mess with the
priorities, we don't have to worry about starvation  (even the worse
case where a waiter's original priority is MAX, the init still gets a
share of time (assuming a reasonable scheduler))

>From this version, adding cancellation / exception handling should be easy.

But I never liked this version much:
   - not sure of the overhead of SetPriority
   - not sure of portability  (stuff like this is inherently not very
portable, and pthreads-win32 obviously doesn't care, but I care for my
   - just 'inelegant' (polling, etc...)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]