Commit Graph

66 Commits

Author SHA1 Message Date
Mike Makonnen
7e2160688c The move to _retire() a thread in the GC instead of in the thread's
exit function has invalidated the need for _spin[un]lock_pthread().
The _spin[un]lock() functions can now dereference curthread without
the danger that the ldtentry containing the pointer to the thread
has been cleared out from under them.
2003-06-29 00:12:40 +00:00
David E. O'Brien
a23e5f4d43 .S comments must be C comments, not ASM ones. 2003-06-02 02:32:56 +00:00
Mike Makonnen
0e335eaeb5 Missing unlock.
Approved by:	re/jhb
2003-05-29 20:49:17 +00:00
Mike Makonnen
12c407a424 Return gracefully, rather than aborting, when the maximum concurrent
threads per process has been reached. Return EAGAIN, as per spec.

Approved by:	re/blanket libthr
2003-05-25 22:40:57 +00:00
Marcel Moolenaar
9e14b94e43 The struct mcontext has changed. It's using the register sets. Bring
this in line.
2003-05-25 06:49:19 +00:00
Mike Makonnen
59a47b31d0 Add two functions: _spinlock_pthread() and _spinunlock_pthread()
that take the address of a struct pthread as their first argument.
_spin[un]lock() just become wrappers arround these two functions.
These new functions are for use in situations where curthread can't be
used. One example is _thread_retire(), where we invalidate the array index
curthread uses to get its pointer..

Approved by:	re/blanket libthr
2003-05-23 23:39:31 +00:00
Mike Makonnen
7d9d7ca2ed Make WARNS2 clean. The fixes mostly included:
o removed unused variables
	o explicit inclusion of header files
	o prototypes for externally defined functions

Approved by:    re/blanket libthr
2003-05-23 09:48:20 +00:00
Mike Makonnen
509d72c4b9 o Make the defenition of _set_curthread() match its declaration
in thr_private.h

o Lock down the ldt_entries array and ldt_free, which points to
  the next free slot. As noted in the comments, it's necessary
  to special case the initial_thread because %gs is not setup
  for it yet. This is ok because that early in the program there
  won't be any reentrancy issues anyways.

Approved by:	re/blanket libthr
2003-05-21 08:21:24 +00:00
Mike Makonnen
a260623c5f Fix a null dereference leading to a core dump when
the number of threads exceeds the number of open slots
in ldt_entries[].

Approved by:	markm (mentor)(implicit)
Reviewed by:	jeff
2003-05-06 02:33:49 +00:00
Marcel Moolenaar
1d3e7116dc Add support for ia64.
Note that the tp register (r13) is reserved as the TLS pointer in
the same way that that gp register (r1) is reserved as the global
pointer. This implementation uses the tp register to point to the
thread structure used by the threads implementation. This is not
in violation with the runtime specification provided the TLS is
a fixed distance from the thread structure. This is only an issue
when code used the __thread keyword to create TLS. This is not
supported at the moment.
2003-04-20 03:06:42 +00:00
Jake Burkholder
55ad402a8f - Pass a ucontext_t to _set_curthread. If non-NULL the new thread is set
as curthread in the new context, so that it will be set automatically when
  the thread is switched to.  This fixes a race where we'd run for a little
  while with curthread unset in _thread_start.

Reviewed by:	jeff
2003-04-03 03:34:50 +00:00
Jeff Roberson
996a395d37 - Don't overrun the ldt buffer.
Submitted by:	gordan@freebsd.org
2003-04-02 22:53:52 +00:00
Jake Burkholder
68c724b96f Implement _get_curthread and _set_curthread. This is especially easy. 2003-04-02 08:15:07 +00:00
Jake Burkholder
dd3dd8724d Add MD makefile. 2003-04-01 23:52:24 +00:00
Jeff Roberson
7a57e9abdd - Adjust the makefiles so we have a per architecture makefile. 2003-04-01 07:07:38 +00:00
Jeff Roberson
bb535300dd - Add libthr but don't hook it up to the regular build yet. This is an
adaptation of libc_r for the thr system call interface.  This is beta
   quality code.
2003-04-01 03:46:29 +00:00