History log of /haiku/headers/posix/pthread.h
Revision Date Author Comments
# b24cc7ca 06-Jun-2023 Augustin Cavalier <waddlesplash@gmail.com>

pthread: Use 1 for PTHREAD_BARRIER_SERIAL_THREAD.

pthread_barrier_wait can return errors, which on Haiku are negative
and so -1 is an error condition, it should not be reused for a magic
constant.

This breaks ABI. However, until the recent fixes, barriers were so broken
that I doubt any application was using them seriously (Mesa, for instance,
has them disabled.)

Change-Id: Ica23921de012a33e9e7aded816bb1347bd157b31
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6517
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: X512 <danger_mail@list.ru>


# d53856a1 24-Aug-2021 Semion Dimov <congocongocongo@protonmail.com>

Added missing posixoptions and sysconf constants according POSIX.1-2017 standard

Change-Id: I2721ea4f2c3dbe0ef6a11c3a61da6034b4a7fd48
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4371
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 799ab823 18-Sep-2022 Jérôme Duval <jerome.duval@gmail.com>

libroot: Add support for C11 Threads missing parts (except gcc2).

The respective files can be found in the FreeBSD source tree at:
- lib/libstdthreads/call_once.c
- lib/libstdthreads/cnd.c
- lib/libstdthreads/mtx.c
- lib/libstdthreads/threads.h
- lib/libstdthreads/tss.c

Missing is support for PTHREAD_DESTRUCTOR_ITERATIONS.

Change-Id: I7a6c79954f36195eadd1351d308c21a001192232
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5675
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# d96e266b 17-Feb-2022 Jérôme Duval <jerome.duval@gmail.com>

POSIX: introduce pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock

will appear in the next version: https://www.opengroup.org/austin/docs/austin_1110.pdf

Change-Id: I83ef657dce54c223e2dc0c207fce17d9238f7115
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4970
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# e41d4bd1 17-Feb-2022 Jérôme Duval <jerome.duval@gmail.com>

POSIX: introduce pthread_mutex_clocklock

will appear in the next version: https://www.opengroup.org/austin/docs/austin_1110.pdf

Change-Id: Id4553754494d6594f159356a73534c3cc9900184
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4969
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# ceb7b761 16-Feb-2022 Jérôme Duval <jerome.duval@gmail.com>

POSIX: introduce pthread_cond_clockwait

will appear in the next version: https://www.opengroup.org/austin/docs/austin_1110.pdf

Change-Id: I964968b81533c43ae95380bff79c8ec423d0a665
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4967
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 47a21c5c 30-Aug-2019 Augustin Cavalier <waddlesplash@gmail.com>

s/Haiku License/MIT License/g.

They are the same thing.


# 901c3d44 05-Mar-2019 Jérôme Duval <jerome.duval@gmail.com>

pthread: implement pthread_attr_[get|set]stack.

remove pthread_attr_[get|set]stackaddr from unimplemented functions.

Change-Id: I58807e86c75a189a576639ae1b2e4505a63700a5
Reviewed-on: https://review.haiku-os.org/c/1152
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 30749200 16-Oct-2018 Leorize <alaviss@users.noreply.github.com>

posix/pthread.h: mark pthread_exit as noreturn

This should prevents GCC from throwing -Werror=return-type when
pthread_exit is used in place of return

Change-Id: Ied7da58b671e77b53d859b67193259aa78ec27d6
Reviewed-on: https://review.haiku-os.org/632
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 6c9e0126 24-Jul-2017 Jérôme Duval <jerome.duval@gmail.com>

pthread_rwlock: use a mutex for process-private locks.

* instead of a benaphore.
* define PTHREAD_RWLOCK_INITIALIZER.
* adjust Init(), Destroy(), StructureLock() and StructureUnlock().


# b70a58f9 29-May-2017 Augustin Cavalier <waddlesplash@gmail.com>

pthread.h: Remove PTHREAD_RWLOCK_INITIALIZER macro.

This reverts commit 17286dc70a81d1aa8d853a73db0b0ebe79e6ed9a.

As discussed on the mailing list. As it turns out, this was less
than half of an actual implementation of this macro, and there's
technically no way to implement it without introducing (theoretical)
race conditions, in the current design anyway.


# 17286dc7 27-May-2017 Joseph C, Hill <calvin@hakobaito.co.uk>

pthread.h: Add PTHREAD_RWLOCK_INITIALIZER macro.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
Fixes #8798. One tiny style fix by me (adding spaces around braces).


# 0bec83a8 21-Feb-2017 Jérôme Duval <jerome.duval@gmail.com>

pthread: add const for pthread_mutex*_get*()

according to the spec. Fixes #13324.
* code style clean up.


# 0e0f49e7 27-Dec-2016 Dmytro Shynkevych <dm.shynk@gmail.com>

libroot: Implemented pthread barriers

This is an implementation of pthread barriers pursuant to the relevant specification.

Barriers are essentially a special case of conditional variables,
such that all threads waiting on one are woken up when the number of
waiters reaches a number provided at the initialization of the barrier.
In view of that, this implementation mimics the implementation of pthread_cond,
except it is more specialized and self-contained.

Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>


# 10b4fed2 02-May-2015 Hamish Morrison <hamishm53@gmail.com>

Add support for pthread_condattr_get/setclock()

* Allows use of either CLOCK_REALTIME or CLOCK_MONOTONIC as the time
base for pthread_cond_timedwait().


# d1f280c8 01-Apr-2012 Hamish Morrison <hamishm53@gmail.com>

Add support for pthread_attr_get/setguardsize()

* Added the aforementioned functions.
* create_area_etc() now takes a guard size parameter.
* The thread_info::stack_base/end range now refers to the usable range
only.


# 24df6592 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0fae8733 03-Nov-2010 Scott McCreary <scottmc2@gmail.com>

Updated posix headers to remove commas from copyright line, to match the preferred coding guidelines.
Cleaned up some header style violations, making sure there are two blank lines after the header guards.
This fixes the posix header part of #2191.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39288 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ef1716f8 17-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Patch by Lucian Adrian Grijincu: Added pthread spinlock support.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36333 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f7127458 15-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Private libroot locking primitives:
- Reimplemented mutex to use the _kern_mutex*() syscalls.
- The initializer functions cannot fail anymore -- changed their return type
to void.
- Changed the initializer function semantics to not copy the name by default
anymore (as in the kernel). Also added *_etc() versions of them that take an
additional flags.
- Added static initializer macros.
- Made the mutex (and thus recursive_lock) lock functions non-interruptable.
- Got rid of the "lazy" version. They are no longer needed, since the
initialization of the standard types can be done statically and cannot fail.
* Adjusted libroot, runtime loader, and other code using the private libroot
locking primitives to the new semantics.
* pthreads mutexes and condition variables:
- Reimplemented using the _kern_mutex*() syscalls.
- Consistently use POSIX error codes.
- Fixed some not quite POSIX compliant behavior.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36323 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 02e6d76c 05-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Replaced enums by macros as required by POSIX.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36041 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 66204ee8 16-Jan-2010 Jérôme Duval <korli@users.berlios.de>

forgot to add prototypes for pthread_getschedparam and pthread_setschedparam(), sorry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35106 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d0b21f13 07-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed obsolete comment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33928 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f386c591 26-Oct-2009 Jérôme Duval <korli@users.berlios.de>

Patch from Michael Franz (ticket #4696): sched.h and pthreads to allow setting of the thread priority


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33783 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c9d7792 08-Mar-2009 Jérôme Duval <korli@users.berlios.de>

* pthread.h should include sched.h (bug #3516)
* semaphore.h should include fcntl.h


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29438 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a411c76c 23-May-2008 Axel Dörfler <axeld@pinc-software.de>

* Added pthread_attr_setscope(), and pthread_attr_getscope(). We only support
PTHREAD_SCOPE_SYSTEM which makes the implementation rather simple.
* This closed ticket #2242.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25628 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a8af2b6d 20-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Some work on pthreads:
* Made the pthread_cond_t internals public. This is necessary to support
process shared condition variables. Fixed initializer macro.
* Made the pthread_rwlockattr_t structure opaque.
* pthread_t is no longer typedef'ed to int. It's the pointer to the
internal _pthread_thread structure.
* Removed __get_pthread(). pthread_self() can be used instead.
* No longer tunnel the pthread exit value through Haiku's thread exit
value. We do have a separate field in the _pthread_thread structure
for it, now.
* Handle detaching of threads correctly.
* pthread_rwlockattr_{g,s}etpshared() use the
PTHREAD_PROCESS_{SHARED,PRIVATE} constants, now.
* Commented out yet unsupported structures (barriers, spinlocks).
* Rebuilt APR optional package. The pthread changes weren't binary
compatible.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25582 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e19c86a 13-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed potential warnings.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25487 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3ca1072d 12-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Reimplemented pthread_once. The old one was neither thread-safe nor
particularly efficient.
* pthread_mutex implementation:
- Removed the pthread_mutex_t indirection (the type was a pointer to
the actual structure which was allocated on the heap), as it made
sharing the mutex between processes impossible.
- Removed the distinction between process shared and non-shared
mutexes. Benaphores work just as well in shared memory, so we always
use them.
* Fixed some static initializer macros. PTHREAD_COND_INITIALIZER is
still broken, since it doesn't work in C code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25481 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 370602bf 12-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added pthread rwlock support.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25470 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b9320128 10-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Patch by Andreas Faerber:
Replaced single-line comments by multi-line comments for ANSI C
compliance.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25433 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f7cc12b3 08-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Implemented pthread_attr_{g,s}etstacksize(). Also added commented-out
prototypes for the missing pthread_attr_*() functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25390 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 945fb7e3 20-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced destructor with destructorFunc to please python - it's not a reserved
keyword, so this stupid python should really be fixed instead.
* Enforced the 80 column limit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25090 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b9fe86d2 07-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Added pthread_setconcurrency(), and pthread_getconcurrency() functions.
* Since we use a 1:1 mapping, they don't do anything besides remembering the
level set, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24855 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c80e6107 31-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Added start of an implementation of pthread_cancel().
* Implemented pthread_setcanceltype(), pthread_setcancelstate(), and
pthread_testcancel().
* In the previous commit, I also made pthread_private.h self-contained.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24710 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a635399b 31-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Rearranged pthread thread support a bit: there is now a pthread_thread
structure that is attached (via TLS) to each pthread.
* Implemented support for pthread_cleanup_{push|pop}().
* I haven't really been able to test these changes, yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24704 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5d2044f6 28-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

POSIX headers should not include BeOS/Haiku headers. Should help with
flex's pthread test.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24625 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d2d67247 07-Dec-2007 Jérôme Duval <korli@users.berlios.de>

added pthread_once() implementation and tests
there is still a TODO on an init race condition


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23076 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4ff6af6d 07-Dec-2007 Jérôme Duval <korli@users.berlios.de>

applied patch by kaliber


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23075 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 550a30a0 22-Sep-2007 Ryan Leavengood <leavengood@gmail.com>

I needed Pthread condition variables for WebKit, so I implemented
them. I have tested this with a simple test program I downloaded
from the internet. We get the same result as on Linux, so I think
this is good. I will test it more with WebKit later.

Our Pthreads implementation is still missing some stuff, but this
adds a good chunk.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22274 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 954f408f 21-Jun-2006 Jérôme Duval <korli@users.berlios.de>

* PTHREAD_MUTEX_INITIALIZER inits to NULL, pthread_mutex_lock now call pthread_mutex_init to support this PTHREAD_MUTEX_INITIALIZER
* pthread_key_create and pthread_key_delete now manages correctly a list of key/destructor
* pthread_create now uses a private thread function to add a "on_exit_thread" call for destructors
* pthread_join now returns B_OK in every case, and, as a joinable thread could already be gone, wait_for_thread would not find it


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17895 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1f11178f 19-Jun-2006 Jérôme Duval <korli@users.berlios.de>

added posix thread specific data functions
added a pthread_detach skeleton


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17880 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a23efdfa 20-Jun-2006 Jérôme Duval <korli@users.berlios.de>

added some pthread_* and pthread_attr_* naive functions
I mapped pthread_t to thread_id for simplicity


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17879 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ad6ada0b 21-Apr-2006 Jérôme Duval <korli@users.berlios.de>

removed struct _pthread* forward declarations, they're not needed
added some more posix definitions, though they might be never used in Haiku


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17184 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b7f854b8 20-Apr-2006 Jérôme Duval <korli@users.berlios.de>

now match pthread_private.h declarations


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17178 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a00ed9fa 19-Apr-2006 Jérôme Duval <korli@users.berlios.de>

added some missing pthreads definitions


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17177 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45b820dd 12-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Made header C++ safe, added prototype for pthread_atfork().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9301 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f924ff50 20-Apr-2003 Axel Dörfler <axeld@pinc-software.de>

Added the public pthread header - right now, only support for mutex and
mutexattr is there, and the header reflects this.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3084 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 10b4fed24fc5c2ad8f53145e91ca6caa6a3950ce 02-May-2015 Hamish Morrison <hamishm53@gmail.com>

Add support for pthread_condattr_get/setclock()

* Allows use of either CLOCK_REALTIME or CLOCK_MONOTONIC as the time
base for pthread_cond_timedwait().


# d1f280c80529d5f0bc55030c2934f9255bc7f6a2 01-Apr-2012 Hamish Morrison <hamishm53@gmail.com>

Add support for pthread_attr_get/setguardsize()

* Added the aforementioned functions.
* create_area_etc() now takes a guard size parameter.
* The thread_info::stack_base/end range now refers to the usable range
only.


# 24df65921befcd0ad0c5c7866118f922da61cb96 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0fae873352b02792db93f721c1a2ff6b240c8ecc 03-Nov-2010 Scott McCreary <scottmc2@gmail.com>

Updated posix headers to remove commas from copyright line, to match the preferred coding guidelines.
Cleaned up some header style violations, making sure there are two blank lines after the header guards.
This fixes the posix header part of #2191.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39288 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ef1716f81b28eeb2acdac6e9f26235b4f552a1b3 17-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Patch by Lucian Adrian Grijincu: Added pthread spinlock support.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36333 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f71274580bc2625bf438140839fe38193ece28e6 15-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Private libroot locking primitives:
- Reimplemented mutex to use the _kern_mutex*() syscalls.
- The initializer functions cannot fail anymore -- changed their return type
to void.
- Changed the initializer function semantics to not copy the name by default
anymore (as in the kernel). Also added *_etc() versions of them that take an
additional flags.
- Added static initializer macros.
- Made the mutex (and thus recursive_lock) lock functions non-interruptable.
- Got rid of the "lazy" version. They are no longer needed, since the
initialization of the standard types can be done statically and cannot fail.
* Adjusted libroot, runtime loader, and other code using the private libroot
locking primitives to the new semantics.
* pthreads mutexes and condition variables:
- Reimplemented using the _kern_mutex*() syscalls.
- Consistently use POSIX error codes.
- Fixed some not quite POSIX compliant behavior.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36323 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 02e6d76c9c62c2621cb56474af70043f13c11b5b 05-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Replaced enums by macros as required by POSIX.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36041 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 66204ee8cf41e21667f1a4802c55a0b3a2595092 16-Jan-2010 Jérôme Duval <korli@users.berlios.de>

forgot to add prototypes for pthread_getschedparam and pthread_setschedparam(), sorry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35106 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d0b21f13ddd989e1ef894d4b5f87227abde2bff6 07-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed obsolete comment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33928 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f386c5910b0920cfa24950dfe81eee67e7d7ba67 26-Oct-2009 Jérôme Duval <korli@users.berlios.de>

Patch from Michael Franz (ticket #4696): sched.h and pthreads to allow setting of the thread priority


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33783 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c9d779293ad96b8e071046f4b2db4ee46c772b5 08-Mar-2009 Jérôme Duval <korli@users.berlios.de>

* pthread.h should include sched.h (bug #3516)
* semaphore.h should include fcntl.h


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29438 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a411c76cd686864a2dc3116d8ff16f3d26786c56 23-May-2008 Axel Dörfler <axeld@pinc-software.de>

* Added pthread_attr_setscope(), and pthread_attr_getscope(). We only support
PTHREAD_SCOPE_SYSTEM which makes the implementation rather simple.
* This closed ticket #2242.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25628 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a8af2b6dda18b77d9bad0f0c32076ca066cf57f1 20-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Some work on pthreads:
* Made the pthread_cond_t internals public. This is necessary to support
process shared condition variables. Fixed initializer macro.
* Made the pthread_rwlockattr_t structure opaque.
* pthread_t is no longer typedef'ed to int. It's the pointer to the
internal _pthread_thread structure.
* Removed __get_pthread(). pthread_self() can be used instead.
* No longer tunnel the pthread exit value through Haiku's thread exit
value. We do have a separate field in the _pthread_thread structure
for it, now.
* Handle detaching of threads correctly.
* pthread_rwlockattr_{g,s}etpshared() use the
PTHREAD_PROCESS_{SHARED,PRIVATE} constants, now.
* Commented out yet unsupported structures (barriers, spinlocks).
* Rebuilt APR optional package. The pthread changes weren't binary
compatible.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25582 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e19c86ab06eeed212e5507a8a9e91a3ff2d4fce 13-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed potential warnings.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25487 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3ca1072d44f03cde375532c43ac778a48536a1a2 12-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Reimplemented pthread_once. The old one was neither thread-safe nor
particularly efficient.
* pthread_mutex implementation:
- Removed the pthread_mutex_t indirection (the type was a pointer to
the actual structure which was allocated on the heap), as it made
sharing the mutex between processes impossible.
- Removed the distinction between process shared and non-shared
mutexes. Benaphores work just as well in shared memory, so we always
use them.
* Fixed some static initializer macros. PTHREAD_COND_INITIALIZER is
still broken, since it doesn't work in C code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25481 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 370602bff6556f6cafc04a67f5a088a2f377eb4b 12-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added pthread rwlock support.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25470 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b93201281504cee31f4186f7c6548815940c576e 10-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Patch by Andreas Faerber:
Replaced single-line comments by multi-line comments for ANSI C
compliance.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25433 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f7cc12b389748853b43a2a4fa42b47ea2f812e61 08-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Implemented pthread_attr_{g,s}etstacksize(). Also added commented-out
prototypes for the missing pthread_attr_*() functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25390 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 945fb7e32ac26f429b82eaeb47736980c3364e47 20-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced destructor with destructorFunc to please python - it's not a reserved
keyword, so this stupid python should really be fixed instead.
* Enforced the 80 column limit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25090 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b9fe86d2d7c66ceff3bd07a6fc82bbe3063e593c 07-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Added pthread_setconcurrency(), and pthread_getconcurrency() functions.
* Since we use a 1:1 mapping, they don't do anything besides remembering the
level set, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24855 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c80e61078900a687a62b5a6c27c37fccf8af352e 31-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Added start of an implementation of pthread_cancel().
* Implemented pthread_setcanceltype(), pthread_setcancelstate(), and
pthread_testcancel().
* In the previous commit, I also made pthread_private.h self-contained.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24710 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a635399b0744555fe9f3fc01d6f58ff29d3bc075 31-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Rearranged pthread thread support a bit: there is now a pthread_thread
structure that is attached (via TLS) to each pthread.
* Implemented support for pthread_cleanup_{push|pop}().
* I haven't really been able to test these changes, yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24704 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5d2044f6432f2531100a5f469597c275cb5b7ecb 28-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

POSIX headers should not include BeOS/Haiku headers. Should help with
flex's pthread test.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24625 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d2d6724788673441c7a06373ce434ee9c8059a2c 07-Dec-2007 Jérôme Duval <korli@users.berlios.de>

added pthread_once() implementation and tests
there is still a TODO on an init race condition


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23076 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4ff6af6d52d2941edfc75d4da9ab6eb3d10e7ffa 07-Dec-2007 Jérôme Duval <korli@users.berlios.de>

applied patch by kaliber


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23075 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 550a30a0b77dcf07a0098b8a0db51afe9b4cd313 22-Sep-2007 Ryan Leavengood <leavengood@gmail.com>

I needed Pthread condition variables for WebKit, so I implemented
them. I have tested this with a simple test program I downloaded
from the internet. We get the same result as on Linux, so I think
this is good. I will test it more with WebKit later.

Our Pthreads implementation is still missing some stuff, but this
adds a good chunk.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22274 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 954f408f50a12e581fbd72742f22627c317ce462 21-Jun-2006 Jérôme Duval <korli@users.berlios.de>

* PTHREAD_MUTEX_INITIALIZER inits to NULL, pthread_mutex_lock now call pthread_mutex_init to support this PTHREAD_MUTEX_INITIALIZER
* pthread_key_create and pthread_key_delete now manages correctly a list of key/destructor
* pthread_create now uses a private thread function to add a "on_exit_thread" call for destructors
* pthread_join now returns B_OK in every case, and, as a joinable thread could already be gone, wait_for_thread would not find it


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17895 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1f11178f9760c849655c0e1c70da715674cf4040 19-Jun-2006 Jérôme Duval <korli@users.berlios.de>

added posix thread specific data functions
added a pthread_detach skeleton


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17880 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a23efdfa79cbe91167c10accddbe3dcfd4317c4e 20-Jun-2006 Jérôme Duval <korli@users.berlios.de>

added some pthread_* and pthread_attr_* naive functions
I mapped pthread_t to thread_id for simplicity


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17879 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ad6ada0be5b9fb1f589ce83a4e852aa0ba8789f8 21-Apr-2006 Jérôme Duval <korli@users.berlios.de>

removed struct _pthread* forward declarations, they're not needed
added some more posix definitions, though they might be never used in Haiku


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17184 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b7f854b819275b2230daf722bb790b2816f2db8b 20-Apr-2006 Jérôme Duval <korli@users.berlios.de>

now match pthread_private.h declarations


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17178 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a00ed9fa2403fd6ede1e38f23f0df9008683c28d 19-Apr-2006 Jérôme Duval <korli@users.berlios.de>

added some missing pthreads definitions


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17177 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45b820dd775e6a6e6816510eca848b341d75e2c0 12-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Made header C++ safe, added prototype for pthread_atfork().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9301 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f924ff50f50f899cc46d44177e5e79b58ec4c847 20-Apr-2003 Axel Dörfler <axeld@pinc-software.de>

Added the public pthread header - right now, only support for mutex and
mutexattr is there, and the header reflects this.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3084 a95241bf-73f2-0310-859d-f6bbb57e9c96