Commit Graph

603 Commits

Author SHA1 Message Date
skrll 0b99767bfe Remove unnecessary include. 2008-08-11 21:45:24 +00:00
matt 2b0c4dcffd Change pthread_mutex_t to use the amount of space as and be congruent to
the version used in the SA version of pthreads.  This preserves binary
compatibility between both versions of the library.
2008-08-02 19:46:30 +00:00
matt c0038aadef Change some type to eliminate some lint warnings. 2008-08-02 16:02:26 +00:00
pooka 6ebb8696c9 add pthread_cond_has_waiters_np() 2008-07-18 16:17:11 +00:00
gmcgarry 5aa0bc7608 Selector registers are 16-bit and binutils 2.18 insists that only 16-bit
accesses are permitted on them.  Therefore, change movl to movw.  No change to
machine code generated.
2008-07-07 13:01:16 +00:00
ad b4c1afd422 Shut lint up. 2008-06-28 16:50:43 +00:00
ad 27e50f7c64 Avoid spurious assertion failure. 2008-06-28 10:37:20 +00:00
ad 0e006eeb6f Minor correction to previous. 2008-06-28 10:36:12 +00:00
ad cbd43ffa55 Now that we have all the scheduling gunk, make these do something useful:
pthread_attr_get_np
pthread_attr_setschedparam
pthread_attr_getschedparam
pthread_attr_setschedpolicy
pthread_attr_getschedpolicy
2008-06-28 10:29:37 +00:00
ad 403a399142 pthread_attr_setstacksize: EINVAL if the requested size is less than
sysconf(_SC_THREAD_STACK_MIN).
2008-06-25 11:07:07 +00:00
ad 39a9e71121 pthread_join: explicitly test for cancellation. 2008-06-25 11:06:34 +00:00
ad 6d153667e5 pthread_kill, pthread_sigmask: return errno, not the return from the system
call. Found by VSTHlite.
2008-06-24 13:45:07 +00:00
ad 10ba267505 Split cond_signal/cond_broadcast into inline and non-inline parts, like
the kernel.
2008-06-23 11:01:19 +00:00
ad d9a30823e2 Move call to pthread__self() later. 2008-06-23 11:00:53 +00:00
ad 3e1711d6de pthread__threadreg_get: mark it const. 2008-06-23 10:39:38 +00:00
ad edbc7575cc pthread_curcpu_np: remove hack for pthread_dummy_lwpctl. 2008-06-23 10:38:39 +00:00
ad 49b506e72f PR lib/38948: libpthread, java: thread awakening itself 2008-06-21 11:27:41 +00:00
rmind e6acd90e07 - Add affinity(3) manual page, which describes thread affinity,
pthread_setaffinity_np(3) and pthread_getaffinity_np(3) functions,
  provides simple code example.
- Add cpuset(3) manual page, which describes API of CPU-sets.

Thanks <wiz> for many improvements!
2008-06-16 14:25:49 +00:00
ad 271002f500 Back out previous because it breaks the build. 2008-06-05 23:38:51 +00:00
ad b4ad7b01a5 glibc compatibile PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, requested by
rafal@.
2008-06-05 21:40:17 +00:00
uwe c39ae7f5d7 Recycle unused _REG_EXPEVT slot in mcontext for _REG_GBR.
As the size of mcontext is not changed, we avoid the hassle of
versioning all the calls that use it.

_REG_EXPEVT was never used by any code in the tree.  Reporting EXPEVT
makes sense only for signals and in that case we pass it to userland
in ksi_trap already which is official MI way to get this (MD) information.

Old binaries running on new kernels will now have their GBR set from
new mcontext, but that's ok too, as GBR was not properly supported by
old kernels (not saved in trapframe), so old binaries couldn't have
possibly used it anyway.
2008-06-01 23:07:20 +00:00
wiz afa117e7f9 Sort sections. Use more markup. 2008-05-26 08:45:55 +00:00
wiz 5904699302 Sort ERRORS. 2008-05-26 08:43:57 +00:00
wiz 6a46b478a7 Remove trailing whitespace. 2008-05-26 08:43:41 +00:00
wiz e1070e84ea Remove duplicate (pasto?) RETURN VALUES section. 2008-05-26 08:43:08 +00:00
wiz 5ae93b7856 Remove trailing whitespace. 2008-05-26 08:41:42 +00:00
ad c4612ba227 More blurb about the mutex and limitations. 2008-05-26 02:25:05 +00:00
ad 3ad4fb5234 Note that when calling pthread_cond_broadcast/signal, the same mutex as
passed to wait/timedwait must be held.
2008-05-26 02:16:48 +00:00
ad bd2852ae8c Add a comment describing some limitiations of this implementation. 2008-05-26 02:06:21 +00:00
ad 9d566f8240 Note that apps with real-time threads shouldn't use spinlocks because of
the danger of deadlock, and note that in general spinlocks suck and mutexes
should be used instead!
2008-05-26 00:31:08 +00:00
ad 6458d64f4c - Eliminate one test+branch.
- Fix a comment.
- Fix a lock leak.
2008-05-26 00:16:35 +00:00
ad dec5fb2e52 pthread_cond_timedwait: don't leak EINTR or EALREADY to the caller. 2008-05-25 23:51:31 +00:00
ad 49ec182c8c Fix error in previous. 2008-05-25 17:11:13 +00:00
ad 2bcb8bf1c4 PR lib/38741 priority inversion in libpthread breaks apps that use
SCHED_FIFO threads

- Change condvar sync so that we never take the condvar's spinlock without
  first holding the caller-provided mutex. Previously, the spinlock was only
  taken without the mutex in an error path, but it was enough to trigger the
  problem described in the PR.

- Even with this change, applications calling pthread_cond_signal/broadcast
  without holding the interlocking mutex are still subject to the problem
  described in the PR. POSIX discourages this saying that it leads to
  undefined scheduling behaviour, which seems good enough for the time being.

- Elsewhere, use a hash of mutexes instead of per-object spinlocks to
  synchronize entry/exit from sleep queues.

- Simplify how sleep queues are maintained.
2008-05-25 17:05:28 +00:00
ad d5afa113a1 Add some general comments about the mutex implementation. 2008-05-25 12:29:59 +00:00
wiz 04845dabb5 Assign to TNF. Make 2-clause instead of 3.
Ok: co-copyright owner hubertf@.
2008-05-09 08:31:13 +00:00
martin 637bc2e71d Move TNF licenses to 2 clause form 2008-05-04 19:43:05 +00:00
martin cd22f25e6f Move TNF licenses to 2 clause form 2008-05-02 18:11:04 +00:00
martin 11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad ecdd2c2965 Cheat and add inlines for _atomic_cas_ptr() to work around gcc emitting
unneeded PIC stuff in mutex_lock() and mutex_unlock(), when a thread
register is used.
2008-03-22 17:59:12 +00:00
ad 783e2f6db5 Back out previous. It seems to expose another bug in libpthread/libc,
potentially errno being used before threading is up and running.
2008-03-22 14:19:27 +00:00
ad 159f554369 Move pthread__errno() into pthread_specific.c so it gets the "no stack
frame" treatment.
2008-03-21 21:35:43 +00:00
rmind 2ac12931eb Add sched(3) manual page, and appropriate links.
Thanks <wiz> for review and fixes!
2008-03-10 14:47:06 +00:00
ad 61f666ba09 _pthread_rwlock_held_np: if write locked, only return true if held by
the current thread.
2008-03-08 13:46:59 +00:00
ad eceac52f08 Complain if _lwp_ctl() fails. 2008-03-08 13:23:13 +00:00
ad 8b2c109b14 Add a cast to make lint happy. 2008-03-08 13:22:22 +00:00
ad 55faac1242 pthread_key_create: instead of using a simple 1/0 value to record a key
as allocated, use an array of pointers and save __builtin_return_address(0)
so keys can be identified when doing post-mortem debugging.
2008-03-07 22:27:07 +00:00
ad 8548e33886 pthread__mutex_lock_slow:
- don't stop spinning if there are already waiters on the mutex, there is
  no point.
- cosmetic change.
2008-03-07 22:23:57 +00:00
ad 6869216239 Fix pthread_mutex_trylock() for recursive mutexes. PR lib/38087.
Based on a patch provided by rafal@.
2008-02-23 15:15:57 +00:00