pthread_barrier_* API implementation

Corinna Vinschen
Mon Feb 8 09:49:00 GMT 2016

On Feb  2 13:49, Václav Haisman wrote:
> On 1 February 2016 at 08:38, Yaakov Selkowitz <> wrote:
> > On 2016-02-01 00:41, Václav Haisman wrote:
> >>
> >> On ([1]) pages, I have noticed that the pthread_barrier_*
> >> POSIX API is missing from Cygwin. I took a look at NetBSD and FreeBSD
> >> implementations of it. It seemed to me that creating POSIX barrier on
> >> top of POSIX mutex and POSIX conditional variable is not that hard ([2]).
> >>
> >> Now, the question is whether this is acceptable and whether it should be
> >> part of Newlib or directly part of Cygwin?
> >
> >
> > IMO a barriers implementation would be welcome.  winsup/cygwin/
> > would be the place for it.


> [...]
> Well, I tried and I started adding the functions into the
> file (
> Then I noticed I do not know where to put the necessary structures.
> Newlib headers seem to already contain some definitions of
> pthread_barrier_t and pthread_barrierattr_t. The organization of the
> source escapes me.

The Cygwin pthread implementation is (unfortunately) completely separate
from the newlib implementation.  Therefore, ignore newlib for now and
just look at the files under winsup/cygwin:

- was supposed to contain external API calls but has been
  widely neglected at one point.  Some rearrangement would certainly
  not hurt.

- contains the bulk of the pthread implementation.

- thread.h contains local datatypes.

- include/pthread.h is Cygwin's pthread header for the user space.
  It completely overrides newlib's include/pthread.h.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <>

More information about the Cygwin-developers mailing list