X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=inline;f=doc%2Fbeyond-ansi.xml;h=140afa9a9110885669ad724c82eb9581cf09f2da;hb=ba2e958087d35c7cb34c965ba61bb4821ca65bc8;hp=c05dcee8bc43409c25ca4370a5dc09cd32e1b5e3;hpb=765d10ae2a59a6c60ec886e29bc7f692f76dcec8;p=sbcl.git
diff --git a/doc/beyond-ansi.xml b/doc/beyond-ansi.xml
index c05dcee..140afa9 100644
--- a/doc/beyond-ansi.xml
+++ b/doc/beyond-ansi.xml
@@ -167,29 +167,6 @@ their documentation strings.
are per-thread.
-sb-ext:quit exits the current thread, not
-necessarily the whole environment. The environment will be shut down
-when the last thread exits.
-
-
-Threads arbitrate between themselves for the user's attention.
-A thread may be in one of three notional states: foreground,
-background, or stopped. When a background process attempts to print a
-repl prompt or to enter the debugger, it will stop and print a message
-saying that it has stopped. The user at his leisure may switch to
-that thread to find out what it needs. If a background thread enters
-the debugger, selecting any restart will put it back into the
-background before it resumes.
-
-
-If the user has multiple views onto the same Lisp image (for
-example, using multiple terminals, or a windowing system, or network
-access) they are typically set up as multiple `sessions' such that each
-view has its own collection of foreground/background/stopped threads.
-sb-thread:make-listener-thread can be used to
-start a new thread in its own `session'.
-
-
Mutexes and condition variables are available for
managing access to shared data: see
@@ -204,6 +181,35 @@ managing access to shared data: see
and poke around in their documentation strings.
+
+Sessions
+
+If the user has multiple views onto the same Lisp image (for
+example, using multiple terminals, or a windowing system, or network
+access) they are typically set up as multiple `sessions' such that
+each view has its own collection of foreground/background/stopped
+threads. A thread which wishes to create a new session can use the
+sb-thread:with-new-session to remove itself from
+the current session (which it shares with its parent and siblings) and
+create a fresh one. See also
+sb-thread:make-listener-thread.
+
+Within a single session, threads arbitrate between themselves
+for the user's attention. A thread may be in one of three notional
+states: foreground, background, or stopped. When a background process
+attempts to print a repl prompt or to enter the debugger, it will stop
+and print a message saying that it has stopped. The user at his
+leisure may switch to that thread to find out what it needs. If a
+background thread enters the debugger, selecting any restart will put
+it back into the background before it resumes. Arbitration for the
+input stream is managed by calls to
+sb-thread:get-foreground (which may block) and
+sb-thread:release-foreground.
+
+sb-ext:quit terminates all threads in the
+current session, but leaves other sessions running
+
+
Implementation (Linux x86)
@@ -224,18 +230,13 @@ expects threading or creates new threads, and the thread library in
question uses %fs in an incompatible way.
-Threads waiting on queues (e.g. for locks or condition
-variables) are put to sleep using sigtimedwait()
-and woken with SIGCONT.
-
-
-&SBCL; at present will alway have at least two tasks running as
-seen from Linux: when the first process has done startup
-initialization (mapping files in place, installing signal handlers
-etc) it creates a new thread to run the Lisp startup and initial
-listener. The original thread stays around to reap dead subthreads
-and deallocate their resources (e.g. stacks) when they exit.
-
+There are two implementation mechanisms for queueing. If SBCL
+was built on an NPTL-capable Linux system (2.6 or some vendor 2.4
+ports) with the :SB-FUTEX feature, queuing will be done using the
+sys_futex() system call if it's available at
+runtime. Otherwise it will fall back to using
+sigtimedwait() to sleep and a signal
+(SIG_DEQUEUE, one of the POSIX RT signals) to wake.
Garbage collection is done with the existing Conservative
Generational GC. Allocation is done in small (typically 8k) regions :
@@ -261,15 +262,12 @@ on keyboard interrupt handling: pressing your terminal's intr key
(typically Control-C) will interrupt all processes in the foreground
process group, including Lisp threads that &SBCL; considers to be
notionally `background'. This is undesirable, so background threads
-are set to ignore the SIGINT signal. Arbitration for the input stream
-is managed by locking on sb-thread::*session-lock*
-
+are set to ignore the SIGINT signal.
-A thread can be created in a new Lisp 'session' (new terminal or
-window) using sb-thread:make-listener-thread.
-These sessions map directly onto POSIX sessions, so that pressing
-Control-C in the wrong window will not interrupt them - this has been
-found to be embarrassing.
+sb-thread:make-listener-thread in addition
+to creating a new Lisp session makes a new POSIX session, so that
+pressing Control-C in one window will not interrupt another listener -
+this has been found to be embarrassing.
@@ -282,10 +280,11 @@ found to be embarrassing.
sb-ext:*posix-argv*. The UNIX environment can be queried with the
sb-ext:posix-getenv function.
-The &SBCL; system can be terminated with sb-ext:quit,
-optionally returning a specified numeric value to the calling Unix
-process. The normal Unix idiom of terminating on end of file on input
-is also supported.
+The &SBCL; system can be terminated with
+sb-ext:quit, (but see notes above about threads
+and sessions) optionally returning a specified numeric value to the
+calling Unix process. The normal Unix idiom of terminating on end of
+file on input is also supported.