Commit [8340bf] Maximize Restore History

semaphores in the runtime

Trivial refactorings:

* Rename STATE_SUSPENDED STATE_STOPPED for elegance. (Spells with the same
number of letters as STATE_RUNNING, things line up nicer.)

* Re-express make_fixnum in terms of MAKE_FIXNUM so that we can use the
latter to define STATE_* names in a manner acceptable to use in
switch-statements.

* Move Mach exception handling initialization to darwin_init from
create_initial_thread so that current_mach_task gets initialized before
the first thread struct is initialized.

The Beef:

Replace condition variables in the runtime with semaphores.

On most platforms use sem_t, but on Darwin use semaphore_t. Hide the
difference behind, os_sem_t, os_sem_init, os_sem_destroy, os_sem_post, and
os_sem_wait.

POSIX realtime semaphores are supposedly safe to use in signal handlers,
unlike condition variables -- and experimentally at least Mach semaphores
on Darwin are a lot less prone to problems.

(Our pthread mutex usage isn't quite kosher either, but it's the
pthread_cond_wait and pthread_cond_broadcast pair that seemed to be
causing most of the trouble.)

Nikodemus Siivola Nikodemus Siivola 2011-11-18

changed src/compiler/generic/objdef.lisp
changed src/runtime/bsd-os.c
changed src/runtime/darwin-os.c
changed src/runtime/darwin-os.h
changed src/runtime/dynbind.c
changed src/runtime/interrupt.c
changed src/runtime/ppc-assem.S
changed src/runtime/print.c
changed src/runtime/runtime.h
changed src/runtime/thread.c
changed src/runtime/thread.h
src/compiler/generic/objdef.lisp Diff Switch to side-by-side view
Loading...
src/runtime/bsd-os.c Diff Switch to side-by-side view
Loading...
src/runtime/darwin-os.c Diff Switch to side-by-side view
Loading...
src/runtime/darwin-os.h Diff Switch to side-by-side view
Loading...
src/runtime/dynbind.c Diff Switch to side-by-side view
Loading...
src/runtime/interrupt.c Diff Switch to side-by-side view
Loading...
src/runtime/ppc-assem.S Diff Switch to side-by-side view
Loading...
src/runtime/print.c Diff Switch to side-by-side view
Loading...
src/runtime/runtime.h Diff Switch to side-by-side view
Loading...
src/runtime/thread.c Diff Switch to side-by-side view
Loading...
src/runtime/thread.h Diff Switch to side-by-side view
Loading...