1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-09 21:20:45 -08:00

This introduces the low-level system threading support. It also adds

the global lock.  The low-level support is a bit over-eager, in that
even at the end of the present series, it will not all be used.  I
think thiat is ok since I plan to use it all eventually -- in
particular for the emacs lisp mutex implementation.

I've only implemented the pthreads-based version.  I think it should
be relatively clear how to port this to other systems, though.

I'd also like to do a "no threads" port that will turn most things
into no-ops, and have thread-creation fail.  I was thinking perhaps
I'd make a future (provide 'threads) conditional on threads actually
working.

One other minor enhancement available here is to make it possible to
set the name of the new thread at the OS layer.  That way gdb, e.g.,
could display thread names.
This commit is contained in:
Tom Tromey 2012-08-15 13:03:17 -06:00
parent 2d525b793f
commit 14b3dc5e4f
7 changed files with 286 additions and 1 deletions

View file

@ -27,6 +27,8 @@ struct thread_state *current_thread = &the_only_thread;
struct thread_state *all_threads = &the_only_thread;
sys_mutex_t global_lock;
static void
mark_one_thread (struct thread_state *thread)
{
@ -103,3 +105,10 @@ unmark_threads (void)
if (iter->m_byte_stack_list)
unmark_byte_stack (iter->m_byte_stack_list);
}
void
init_threads (void)
{
sys_mutex_init (&global_lock);
sys_mutex_lock (&global_lock);
}