Discussion:
pthread_barrier_* API implementation
Václav Haisman
2016-02-01 06:41:48 UTC
Permalink
Hi.

On rakudo.org ([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?

Second, if I should pursue that, or if anyone who knows either Newlib or
Cygwin better than I wants to mould the source into an acceptable form.
I would not mind somebody else doing it. :D

I have, in the past, contributed small patches to Cygwin and I had done
the necessary copyright assignment paper work, so copyright should not
be a problem.


[1]: http://rakudo.org/how-to-get-rakudo/#Installing-Rakudo-Star-Cygwin
[2]: https://gist.github.com/wilx/bb77de5d3f554afedd79
--
VH
Yaakov Selkowitz
2016-02-01 07:38:02 UTC
Permalink
Post by Václav Haisman
On rakudo.org ([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/thread.cc
would be the place for it.
Post by Václav Haisman
Second, if I should pursue that, or if anyone who knows either Newlib or
Cygwin better than I wants to mould the source into an acceptable form.
I would not mind somebody else doing it. :D
PTC. :-)
Post by Václav Haisman
I have, in the past, contributed small patches to Cygwin and I had done
the necessary copyright assignment paper work, so copyright should not
be a problem.
That would certainly be a prerequisite.
--
Yaakov
Václav Haisman
2016-02-02 12:49:56 UTC
Permalink
Post by Yaakov Selkowitz
Post by Václav Haisman
On rakudo.org ([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/thread.cc
would be the place for it.
Post by Václav Haisman
Second, if I should pursue that, or if anyone who knows either Newlib or
Cygwin better than I wants to mould the source into an acceptable form.
I would not mind somebody else doing it. :D
PTC. :-)
Post by Václav Haisman
I have, in the past, contributed small patches to Cygwin and I had done
the necessary copyright assignment paper work, so copyright should not
be a problem.
That would certainly be a prerequisite.
--
Yaakov
Well, I tried and I started adding the functions into the thread.cc
file (https://github.com/wilx/newlib-cygwin/commit/bf917b59d644eaac8fb5f72c5060bb44aa044804).
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.
--
VH
Corinna Vinschen
2016-02-08 09:49:36 UTC
Permalink
Post by Václav Haisman
Post by Yaakov Selkowitz
Post by Václav Haisman
On rakudo.org ([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/thread.cc
would be the place for it.
ACK
Post by Václav Haisman
[...]
Well, I tried and I started adding the functions into the thread.cc
file (https://github.com/wilx/newlib-cygwin/commit/bf917b59d644eaac8fb5f72c5060bb44aa044804).
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:

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

- thread.cc 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.


HTH,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
Loading...