History log of /freebsd/lib/libthr/thread/thr_mutex.c (Results 176 – 200 of 209)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# e6262545 21-Dec-2005 David Xu <davidxu@FreeBSD.org>

Let _mutex_cv_lock call internal functiona mutex_lock_common.


# e6a9baa2 12-Dec-2005 David Xu <davidxu@FreeBSD.org>

Remove unused _get_curthread() call.


Revision tags: release/6.0.0_cvs, release/6.0.0
# ad7c4916 19-Aug-2005 Stefan Farfeleder <stefanf@FreeBSD.org>

- Prefix MUTEX_TYPE_MAX with PTHREAD_ to avoid namespace pollution.
- Remove the macros MUTEX_TYPE_FAST and MUTEX_TYPE_COUNTING_FAST.

OK'ed by: deischen


Revision tags: release/5.4.0_cvs, release/5.4.0
# a091d823 02-Apr-2005 David Xu <davidxu@FreeBSD.org>

Import my recent 1:1 threading working. some features improved includes:
1. fast simple type mutex.
2. __thread tls works.
3. asynchronous cancellation works ( using signal ).
4. thread synchroni

Import my recent 1:1 threading working. some features improved includes:
1. fast simple type mutex.
2. __thread tls works.
3. asynchronous cancellation works ( using signal ).
4. thread synchronization is fully based on umtx, mainly, condition
variable and other synchronization objects were rewritten by using
umtx directly. those objects can be shared between processes via
shared memory, it has to change ABI which does not happen yet.
5. default stack size is increased to 1M on 32 bits platform, 2M for
64 bits platform.
As the result, some mysql super-smack benchmarks show performance is
improved massivly.

Okayed by: jeff, mtm, rwatson, scottl

show more ...


Revision tags: release/4.11.0_cvs, release/4.11.0, release/5.3.0_cvs, release/5.3.0
# 2d79470f 22-Sep-2004 Mike Makonnen <mtm@FreeBSD.org>

Remove vestiges of libthr's signal mangling past. This fixes that last
known problem with mysql on libthr: not being able to kill mysqld.


# ff9af45a 22-Sep-2004 Mike Makonnen <mtm@FreeBSD.org>

The SUSv3 function say that the affected functions MAY FAIL, if the
specified mutex is invalid. In spec parlance 'MAY FAIL' means it's
up to the implementor. So, remove the check for NULL pointers fo

The SUSv3 function say that the affected functions MAY FAIL, if the
specified mutex is invalid. In spec parlance 'MAY FAIL' means it's
up to the implementor. So, remove the check for NULL pointers for two
reasons:
1. A mutex may be invalid without necessarily being NULL.
2. If the pointer to the mutex is NULL core-dumping in the
vicinity of the problem is much much much better than failing
in some other part of the code (especially when the application
doesn't check the return value of the function that you oh so
helpfully set to EINVAL).

show more ...


# 0feabab5 30-Jul-2004 Mike Makonnen <mtm@FreeBSD.org>

o Assertions to catch that stuff that shouldn't happen is not happening.
o In the rwlock code: move a duplicated check inside an if..else to after
the if...else clause.
o When initializing a static

o Assertions to catch that stuff that shouldn't happen is not happening.
o In the rwlock code: move a duplicated check inside an if..else to after
the if...else clause.
o When initializing a static rwlock move the initialization check
inside the lock.
o In thr_setschedparam.c: When breaking out of the trylock...retry if busy
loop make sure to reset the mtx pointer to null if the mutex is nolonger
in a queue.

show more ...


# cd28f17d 02-Jul-2004 Marcel Moolenaar <marcel@FreeBSD.org>

Change the thread ID (thr_id_t) used for 1:1 threading from being a
pointer to the corresponding struct thread to the thread ID (lwpid_t)
assigned to that thread. The primary reason for this change i

Change the thread ID (thr_id_t) used for 1:1 threading from being a
pointer to the corresponding struct thread to the thread ID (lwpid_t)
assigned to that thread. The primary reason for this change is that
libthr now internally uses the same ID as the debugger and the kernel
when referencing to a kernel thread. This allows us to implement the
support for debugging without additional translations and/or mappings.

To preserve the ABI, the 1:1 threading syscalls, including the umtx
locking API have not been changed to work on a lwpid_t. Instead the
1:1 threading syscalls operate on long and the umtx locking API has
not been changed except for the contested bit. Previously this was
the least significant bit. Now it's the most significant bit. Since
the contested bit should not be tested by userland, this change is
not expected to be visible. Just to be sure, UMTX_CONTESTED has been
removed from <sys/umtx.h>.

Reviewed by: mtm@
ABI preservation tested on: i386, ia64

show more ...


Revision tags: release/4.10.0_cvs, release/4.10.0
# 4cd18a22 20-May-2004 Mike Makonnen <mtm@FreeBSD.org>

Make libthr async-signal-safe without costly signal masking. The guidlines I
followed are: Only 3 functions (pthread_cancel, pthread_setcancelstate,
pthread_setcanceltype) are required to be async-si

Make libthr async-signal-safe without costly signal masking. The guidlines I
followed are: Only 3 functions (pthread_cancel, pthread_setcancelstate,
pthread_setcanceltype) are required to be async-signal-safe by POSIX. None of
the rest of the pthread api is required to be async-signal-safe. This means
that only the three mentioned functions are safe to use from inside
signal handlers.
However, there are certain system/libc calls that are
cancellation points that a caller may call from within a signal handler,
and since they are cancellation points calls have to be made into libthr
to test for cancellation and exit the thread if necessary. So, the
cancellation test and thread exit code paths must be async-signal-safe
as well. A summary of the changes follows:

o Almost all of the code paths that masked signals, as well as locking the
pthread structure now lock only the pthread structure.
o Signals are masked (and left that way) as soon as a thread enters
pthread_exit().
o The active and dead threads locks now explicitly require that signals
are masked.
o Access to the isdead field of the pthread structure is protected by both
the active and dead list locks for writing. Either one is sufficient for
reading.
o The thread state and type fields have been combined into one three-state
switch to make it easier to read without requiring a lock. It doesn't need
a lock for writing (and therefore for reading either) because only the
current thread can write to it and it is an integer value.
o The thread state field of the pthread structure has been eliminated. It
was an unnecessary field that mostly duplicated the flags field, but
required additional locking that would make a lot more code paths require
signal masking. Any truly unique values (such as PS_DEAD) have been
reborn as separate members of the pthread structure.
o Since the mutex and condvar pthread functions are not async-signal-safe
there is no need to muck about with the wait queues when handling
a signal ...
o ... which also removes the need for wrapping signal handlers and sigaction(2).
o The condvar and mutex async-cancellation code had to be revised as a result
of some of these changes, which resulted in semi-unrelated changes which
would have been difficult to work on as a separate commit, so they are
included as well.

The only part of the changes I am worried about is related to locking for
the pthread joining fields. But, I will take a closer look at them once this
mega-patch is committed.

show more ...


# 7295f696 20-May-2004 Mike Makonnen <mtm@FreeBSD.org>


# 0c3a9426 29-Mar-2004 Mike Makonnen <mtm@FreeBSD.org>

The thread suspend function now returns ETIMEDOUT, not EAGAIN.


# 7c8aa413 27-Mar-2004 Mike Makonnen <mtm@FreeBSD.org>

Stop using signals for synchronizing threads. The performance penalty
was too much.


# 81fda5bd 26-Mar-2004 Mike Makonnen <mtm@FreeBSD.org>

o The mutex locking functions aren't normally cancellation points. But,
we still have to DTRT when an asynchronously cancellable thread is
cancelled while waiting for a mutex.
o While dequeueing

o The mutex locking functions aren't normally cancellation points. But,
we still have to DTRT when an asynchronously cancellable thread is
cancelled while waiting for a mutex.
o While dequeueing a waiting mutex don't skip a thread if it has
a cancel pending. Only skip it if it is also async cancellable.

show more ...


Revision tags: release/5.2.1_cvs, release/5.2.1
# a561651c 18-Feb-2004 Mike Makonnen <mtm@FreeBSD.org>

o Refactor and, among other things, get rid of insane nesting levels.
o Fix mutex priority protocols. Keep separate counts of priority
inheritance and protection mutexes to make things easier.
Th

o Refactor and, among other things, get rid of insane nesting levels.
o Fix mutex priority protocols. Keep separate counts of priority
inheritance and protection mutexes to make things easier.
This will not have much affect since this is only the
userland side, and the rest involves kernel scheduling.

show more ...


# 1c6841ae 19-Jan-2004 Mike Makonnen <mtm@FreeBSD.org>

Refactor _pthread_mutex_init
o Simplify the logic by removing a lot of unnecesary nesting
o Reduce the amount of local variables
o Zero-out the allocated structure and get rid of
all the unnece

Refactor _pthread_mutex_init
o Simplify the logic by removing a lot of unnecesary nesting
o Reduce the amount of local variables
o Zero-out the allocated structure and get rid of
all the unnecessary setting to 0 and NULL;

Refactor _pthread_mutex_destroy
o Simplify the logic by removing a lot of unnecesary nesting
o No need to check pointer that the mutex attributes points
to. Checking passed in pointer is enough.

show more ...


Revision tags: release/5.2.0_cvs, release/5.2.0
# 2aa9de1f 30-Dec-2003 Mike Makonnen <mtm@FreeBSD.org>

o Implement pthread_mutex_timedlock(), which does not block indefinitely on
a mutex locked by another thread.
o document it: pthread_mutex_timedlock(3)


# 2b33fc64 30-Dec-2003 Mike Makonnen <mtm@FreeBSD.org>

Make it possible for the library to specify a timeout value when
waiting on a locked mutex. This involves passing a struct timespec
from the pthread mutex locking interfaces all the way down to the
f

Make it possible for the library to specify a timeout value when
waiting on a locked mutex. This involves passing a struct timespec
from the pthread mutex locking interfaces all the way down to the
function that suspends the thread until the mutex is released.
The timeout is assumed to be an absolute time (i.e. not relative to
the current time).

Also, in _thread_suspend() make the passed in timespec const.

show more ...


# 89552201 09-Dec-2003 Mike Makonnen <mtm@FreeBSD.org>

Fix the wrapper function around signals so that a signal handling
thread on one of the mutex or condition variable queues is removed
from those queues before the real signal handler is called.


Revision tags: release/4.9.0_cvs, release/4.9.0
# 659045ff 06-Jul-2003 Mike Makonnen <mtm@FreeBSD.org>

Change all instances of THR_LOCK/UNLOCK, etc to UMTX_*.
It is a more acurate description of the locks they
operate on.


# e921a3c9 03-Jul-2003 Mike Makonnen <mtm@FreeBSD.org>

_pthread_mutex_trylock() is another internal libc function that must block
signals.


# f493d09a 02-Jul-2003 Mike Makonnen <mtm@FreeBSD.org>

Begin making libthr async signal safe.

Create a private, single underscore, version of pthread_mutex_unlock for libc.
pthread_mutex_lock already has one. These versions are different from the
ones t

Begin making libthr async signal safe.

Create a private, single underscore, version of pthread_mutex_unlock for libc.
pthread_mutex_lock already has one. These versions are different from the
ones that applications will link against because they block all signals
from the time a call to lock the mutex is made until it is successfully
unlocked.

show more ...


# 745a4a9e 01-Jul-2003 Mike Makonnen <mtm@FreeBSD.org>

Do not attempt to reque a thread on a mutex queue. It may be that
a thread receives a spurious wakeup from sigtimedwait(), so make sure
that the call to the queueing code is called only once before e

Do not attempt to reque a thread on a mutex queue. It may be that
a thread receives a spurious wakeup from sigtimedwait(), so make sure
that the call to the queueing code is called only once before entering
the loop (not in the loop). This should fix some fatal errors people
are seeing with messages stating the thread is already on the mutex queue.
These errors may still be triggered from signal handlers; however, since
that part of the code is not locked down yet.

show more ...


# fadd82e3 30-Jun-2003 Mike Makonnen <mtm@FreeBSD.org>

Catchup with _thread_suspend() changes.


# dbc6f4c0 30-Jun-2003 Mike Makonnen <mtm@FreeBSD.org>

Sweep through pthread locking and use the new locking primitives for
libthr.


Revision tags: release/5.1.0_cvs, release/5.1.0
# 43844120 02-Jun-2003 Mike Makonnen <mtm@FreeBSD.org>

Consolidate static_init() and static_init_private into one function.
The behaviour of this function is controlled by the argument: private.


123456789