This is the mail archive of the mailing list for the pthreads-win32 project. See the pthreads-win32 home page for more information.

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

Re: semaphores

On Tue, 20 Apr 1999, Michael Ambrus wrote:

> Hi,
> I've tried the new semaphores and they seem to work fine except that errno
> is not properly set as Ross said.

Are you using the 1999-04-07 snapshot? Anything before that should
be upgraded. Can you provide me with some code that illustrates the
problem? The simple test I wrote (tests/errno1.c in the source tree)
checks that two threads can set and retrieve values of errno
independently. The test succeeds for MSVC (tested on WinNT) and
Mingw32 (tested on Win98).

> I'm confused about the "pshared" attribute
> though. Should it not be != 0 if the semaphore is to be shared between
> processes/treads ?

pshared should be non-zero for shared semaphores, however,
pthreads-win32 doesn't yet support any process shared objects. So
sem_init should return EPERM if you set pshared != 0.

| Ross Johnson         |   | E-Mail:
| Info Sciences and Eng|___|
| University of Canberra   | FAX:    +61 6 2015227
| PO Box 1                 |
| Belconnen  ACT    2616   | WWW:
| AUSTRALIA                |