<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libpthread/thread/thr_find_thread.c, branch releng/6.2</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>1. Move thread list flags into new separate member, and atomically</title>
<updated>2004-10-23T23:28:36+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2004-10-23T23:28:36+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b4f9f84b962fcd8c899067dbfa2976254213d9df'/>
<id>b4f9f84b962fcd8c899067dbfa2976254213d9df</id>
<content type='text'>
   put DEAD thread on GC list, this closes a race between pthread_join
   and thr_cleanup.
2. Introduce a mutex to protect tcb initialization, tls allocation and
   deallocation code in rtld seems no lock protection or it is broken,
   under stress testing, memory is corrupted.

Reviewed by: deischen
patch partly provided by: deischen
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
   put DEAD thread on GC list, this closes a race between pthread_join
   and thr_cleanup.
2. Introduce a mutex to protect tcb initialization, tls allocation and
   deallocation code in rtld seems no lock protection or it is broken,
   under stress testing, memory is corrupted.

Reviewed by: deischen
patch partly provided by: deischen
</pre>
</div>
</content>
</entry>
<entry>
<title>o Eliminate upcall for PTHREAD_SYSTEM_SCOPE thread, now it</title>
<updated>2003-07-17T23:02:30+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2003-07-17T23:02:30+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=090b336154a0d8570ea8fad84e60e7d49aa801e7'/>
<id>090b336154a0d8570ea8fad84e60e7d49aa801e7</id>
<content type='text'>
  is system bound thread and when it is blocked, no upcall is generated.

o Add ability to libkse to allow it run in pure 1:1 threading mode,
  defining SYSTEM_SCOPE_ONLY in Makefile can turn on this option.

o Eliminate code for installing dummy signal handler for sigwait call.

o Add hash table to find thread.

Reviewed by: deischen
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  is system bound thread and when it is blocked, no upcall is generated.

o Add ability to libkse to allow it run in pure 1:1 threading mode,
  defining SYSTEM_SCOPE_ONLY in Makefile can turn on this option.

o Eliminate code for installing dummy signal handler for sigwait call.

o Add hash table to find thread.

Reviewed by: deischen
</pre>
</div>
</content>
</entry>
<entry>
<title>Change low-level locking a bit so that we can tell if</title>
<updated>2003-05-24T02:29:25+00:00</updated>
<author>
<name>Daniel Eischen</name>
<email>deischen@FreeBSD.org</email>
</author>
<published>2003-05-24T02:29:25+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=1cb570c53190e8b569091f708781c6bf9c3126c7'/>
<id>1cb570c53190e8b569091f708781c6bf9c3126c7</id>
<content type='text'>
a lock is being waitied on.

Fix a races in join and cancellation.

When trying to wait on a CV and the library is not yet
threaded, make it threaded so that waiting actually works.

When trying to nanosleep() and we're not threaded, just
call the system call nanosleep instead of adding the thread
to the wait queue.

Clean up adding/removing new threads to the "all threads queue",
assigning them unique ids, and tracking how many active threads
there are.  Do it all when the thread is added to the scheduling
queue instead of making pthread_create() know how to do it.

Fix a race where a thread could be marked for signal delivery
but it could be exited before we actually add the signal to it.

Other minor cleanups and bug fixes.

Submitted by:	davidxu
Approved by:	re@ (blanket for libpthread)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
a lock is being waitied on.

Fix a races in join and cancellation.

When trying to wait on a CV and the library is not yet
threaded, make it threaded so that waiting actually works.

When trying to nanosleep() and we're not threaded, just
call the system call nanosleep instead of adding the thread
to the wait queue.

Clean up adding/removing new threads to the "all threads queue",
assigning them unique ids, and tracking how many active threads
there are.  Do it all when the thread is added to the scheduling
queue instead of making pthread_create() know how to do it.

Fix a race where a thread could be marked for signal delivery
but it could be exited before we actually add the signal to it.

Other minor cleanups and bug fixes.

Submitted by:	davidxu
Approved by:	re@ (blanket for libpthread)
</pre>
</div>
</content>
</entry>
<entry>
<title>o Don't add a scope system thread's KSE to the list of available</title>
<updated>2003-04-28T23:56:12+00:00</updated>
<author>
<name>Daniel Eischen</name>
<email>deischen@FreeBSD.org</email>
</author>
<published>2003-04-28T23:56:12+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=55613576f5c40d62fecb4ab76f012917fc399c3e'/>
<id>55613576f5c40d62fecb4ab76f012917fc399c3e</id>
<content type='text'>
  KSEs when it's thread exits; allow the GC handler to do that.

o Make spinlock/spinlock critical regions.

The following were submitted by davidxu

  o Alow thr_switch() to take a null mailbox argument.

  o Better protect cancellation checks.

  o Don't set KSE specific data when creating new KSEs; rely on the
    first upcall of the KSE to set it.

  o Add the ability to set the maximum concurrency level and do this
    automatically.  We should have a way to enable/disable this with
    some sort of tunable because some applications may not want this
    to be the default.

  o Hold the scheduling lock across thread switch calls.

  o If scheduling of a thread fails, make sure to remove it from the list
    of active threads.

  o Better protect accesses to a joining threads when the target thread is
    exited and detached.

  o Remove some macro definitions that are now provided by &lt;sys/kse.h&gt;.

  o Don't leave the library in threaded mode if creation of the initial
    KSE fails.

  o Wakeup idle KSEs when there are threads ready to run.

  o Maintain the number of threads active in the priority queue.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  KSEs when it's thread exits; allow the GC handler to do that.

o Make spinlock/spinlock critical regions.

The following were submitted by davidxu

  o Alow thr_switch() to take a null mailbox argument.

  o Better protect cancellation checks.

  o Don't set KSE specific data when creating new KSEs; rely on the
    first upcall of the KSE to set it.

  o Add the ability to set the maximum concurrency level and do this
    automatically.  We should have a way to enable/disable this with
    some sort of tunable because some applications may not want this
    to be the default.

  o Hold the scheduling lock across thread switch calls.

  o If scheduling of a thread fails, make sure to remove it from the list
    of active threads.

  o Better protect accesses to a joining threads when the target thread is
    exited and detached.

  o Remove some macro definitions that are now provided by &lt;sys/kse.h&gt;.

  o Don't leave the library in threaded mode if creation of the initial
    KSE fails.

  o Wakeup idle KSEs when there are threads ready to run.

  o Maintain the number of threads active in the priority queue.
</pre>
</div>
</content>
</entry>
<entry>
<title>Sorry folks; I accidentally committed a patch from what I was working</title>
<updated>2003-04-18T07:09:43+00:00</updated>
<author>
<name>Daniel Eischen</name>
<email>deischen@FreeBSD.org</email>
</author>
<published>2003-04-18T07:09:43+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=e4c2ac1637ab1039778694ccb3b91425371e0562'/>
<id>e4c2ac1637ab1039778694ccb3b91425371e0562</id>
<content type='text'>
on a couple of days ago.  This should be the most recent changes.

Noticed by:	davidxu
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
on a couple of days ago.  This should be the most recent changes.

Noticed by:	davidxu
</pre>
</div>
</content>
</entry>
<entry>
<title>Revamp libpthread so that it has a chance of working in an SMP</title>
<updated>2003-04-18T05:04:16+00:00</updated>
<author>
<name>Daniel Eischen</name>
<email>deischen@FreeBSD.org</email>
</author>
<published>2003-04-18T05:04:16+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=a0240e2cb0b1ef8e5b61930ac2b850c884daaba8'/>
<id>a0240e2cb0b1ef8e5b61930ac2b850c884daaba8</id>
<content type='text'>
environment.  This includes support for multiple KSEs and KSEGs.

The ability to create more than 1 KSE via pthread_setconcurrency()
is in the works as well as support for PTHREAD_SCOPE_SYSTEM threads.
Those should come shortly.

There are still some known issues which davidxu and I are working
on, but it'll make it easier for us by committing what we have.

This library now passes all of the ACE tests that libc_r passes
with the exception of one.  It also seems to work OK with KDE
including konqueror, kwrite, etc.  I haven't been able to get
mozilla to run due to lack of java plugin, so I'd be interested
to see how it works with that.

Reviewed by:	davidxu
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
environment.  This includes support for multiple KSEs and KSEGs.

The ability to create more than 1 KSE via pthread_setconcurrency()
is in the works as well as support for PTHREAD_SCOPE_SYSTEM threads.
Those should come shortly.

There are still some known issues which davidxu and I are working
on, but it'll make it easier for us by committing what we have.

This library now passes all of the ACE tests that libc_r passes
with the exception of one.  It also seems to work OK with KDE
including konqueror, kwrite, etc.  I haven't been able to get
mozilla to run due to lack of java plugin, so I'd be interested
to see how it works with that.

Reviewed by:	davidxu
</pre>
</div>
</content>
</entry>
<entry>
<title>Make the changes needed for libpthread to compile in its new home.</title>
<updated>2002-09-16T08:45:36+00:00</updated>
<author>
<name>Jonathan Mini</name>
<email>mini@FreeBSD.org</email>
</author>
<published>2002-09-16T08:45:36+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=cc118d869b950c0c5b934133ed4184e83d88553b'/>
<id>cc118d869b950c0c5b934133ed4184e83d88553b</id>
<content type='text'>
The new libpthread will provide POSIX threading support using KSE.
These files were previously repo-copied from src/lib/libc_r.

Reviewed by:	deischen
Approved by:	-arch
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The new libpthread will provide POSIX threading support using KSE.
These files were previously repo-copied from src/lib/libc_r.

Reviewed by:	deischen
Approved by:	-arch
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix a race condition in pthread_join().  All of the following must occur</title>
<updated>2001-06-27T11:41:15+00:00</updated>
<author>
<name>Jason Evans</name>
<email>jasone@FreeBSD.org</email>
</author>
<published>2001-06-27T11:41:15+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=651974ee9200d32da898bb338dd0471914e8409a'/>
<id>651974ee9200d32da898bb338dd0471914e8409a</id>
<content type='text'>
atomically:

1) Search _thread_list for the thread to join.
2) Search _dead_list for the thread to join.
3) Set the running thread as the joiner.

While we're at it, fix a race in the case where multiple threads try to
join on the same thread.  POSIX says that the behavior of multiple joiners
is undefined, but the fix is cheap as a result of the other fix.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
atomically:

1) Search _thread_list for the thread to join.
2) Search _dead_list for the thread to join.
3) Set the running thread as the joiner.

While we're at it, fix a race in the case where multiple threads try to
join on the same thread.  POSIX says that the behavior of multiple joiners
is undefined, but the fix is cheap as a result of the other fix.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add weak definitions for wrapped system calls.  In general:</title>
<updated>2001-01-24T13:03:38+00:00</updated>
<author>
<name>Daniel Eischen</name>
<email>deischen@FreeBSD.org</email>
</author>
<published>2001-01-24T13:03:38+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=e5106342c6de9cbe26c4827e4e29bae309cd8cfb'/>
<id>e5106342c6de9cbe26c4827e4e29bae309cd8cfb</id>
<content type='text'>
	_foo - wrapped system call
	foo - weak definition to _foo

and for cancellation points:

	_foo - wrapped system call
	__foo - enter cancellation point, call _foo(), leave
	        cancellation point
	foo - weak definition to __foo

Change use of global _thread_run to call a function to get the
currently running thread.

Make all pthread_foo functions weak definitions to _pthread_foo,
where _pthread_foo is the implementation.  This allows an application
to provide its own pthread functions.

Provide slightly different versions of pthread_mutex_lock and
pthread_mutex_init so that we can tell the difference between
a libc mutex and an application mutex.  Threads holding mutexes
internal to libc should never be allowed to exit, call signal
handlers, or cancel.

Approved by:	-arch
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	_foo - wrapped system call
	foo - weak definition to _foo

and for cancellation points:

	_foo - wrapped system call
	__foo - enter cancellation point, call _foo(), leave
	        cancellation point
	foo - weak definition to __foo

Change use of global _thread_run to call a function to get the
currently running thread.

Make all pthread_foo functions weak definitions to _pthread_foo,
where _pthread_foo is the implementation.  This allows an application
to provide its own pthread functions.

Provide slightly different versions of pthread_mutex_lock and
pthread_mutex_init so that we can tell the difference between
a libc mutex and an application mutex.  Threads holding mutexes
internal to libc should never be allowed to exit, call signal
handlers, or cancel.

Approved by:	-arch
</pre>
</div>
</content>
</entry>
<entry>
<title>$Id$ -&gt; $FreeBSD$</title>
<updated>1999-08-28T00:22:10+00:00</updated>
<author>
<name>Peter Wemm</name>
<email>peter@FreeBSD.org</email>
</author>
<published>1999-08-28T00:22:10+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=7f3dea244c40159a41ab22da77a434d7c5b5e85a'/>
<id>7f3dea244c40159a41ab22da77a434d7c5b5e85a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
