semaphores

Ross Johnson rpj@ise.canberra.edu.au
Sun Jun 2 21:35:00 GMT 2002


Rob Fanner wrote:
> this might be a good alternative
> 
>      if ( ReleaseSemaphore( (*sem)->sem, GREATER_THAN_MAXIMUM_SEM_VALUE,
> &value) )
>         {
>           *sval = value;
>         }
> 
> Sorry that I've not hacked this into the source and sent you a correct
> patch, but I'm still not confident with VC++ builds, and
> I'm still a bit clueless as to how to set up a pthreadVCE.lib (which I need)
> as opposed to a pthreadVC.lib (the standard
> build for the distro's .dsp file).

Great! Unless there are any problems with this, it will go into the 
next snapshot.

Re pthreadVCE.lib, if you've built the pthreadVC.lib version 
successfully using the .dsp file, you should only need to add the 
following compiler flags:-

/GX /TP /D__CLEANUP_CXX

to build pthreadVCE.lib/.dll (and change the names of your output 
files of course). I don't recall off-hand what /TP does, but it's 
included with the other flags in the Makefile. This is what I use 
for the pre-built libs.

If you're using pthreadVCE.lib then you should also be defining 
__CLEANUP_CXX for your application build, so that the appropriate 
sections of pthread.h are included.

You may be interested in reading Q4 and Q5 in the pthreads-win32 FAQ 
file at:-

ftp://sources.redhat.com/pub/pthreads-win32/FAQ

or the section "SNAPSHOT 2002-03-02 / Cleanup code default style" at:-

http://sources.redhat.com/pthreads-win32/news.html

This will explain why the build defaults to pthreadVC. For 
additional information, the problems/issues have been discussed on 
the mailing list a couple of times, the most recent thread starts at:-

http://sources.redhat.com/ml/pthreads-win32/2001/msg00143.html

Regards.
Ross



More information about the Pthreads-win32 mailing list