File: basic.texi

package info (click to toggle)
s48-refman 1-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 712 kB
  • sloc: makefile: 37
file content (51 lines) | stat: -rw-r--r-- 2,040 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@node Basic thread operations
@section Basic thread operations

@stindex threads
This section describes the @code{threads} structure.

@cindex spawning threads
@cindex threads, spawning
@deffn procedure spawn thunk [name] @returns{} thread
@code{Spawn} constructs a new thread and instructs the current thread
scheduler to commence running the new thread.  @var{Name}, if present,
is used for debugging.  The new thread has a fresh
@embedref{Fluid/dynamic bindings, dynamic environment}.
@end deffn

There are several miscellaneous facilities for thread operations.

@cindex yielding threads
@cindex thread yielding
@cindex sleeping threads
@cindex thread sleeping
@deffn procedure relinquish-timeslice @returns{} unspecified
@deffnx procedure sleep count @returns{} unspecified
@code{Relinquish-timeslice} relinquishes the remaining quantum that the
current thread has to run; this allows the current scheduler run the
next thread immediately.  @code{Sleep} suspends the current thread for
@var{count} milliseconds.
@end deffn

@cindex thread termination
@cindex terminating threads
@deffn procedure terminate-current-thread @returns{} (does not return)
Terminates the current thread, running all @code{dynamic-wind} exit
points.  @code{Terminate-current-thread} obviously does not return.
@end deffn

@cindex thread descriptors
Threads may be represented and manipulated in first-class thread
descriptor objects.

@deffn procedure current-thread @returns{} thread
@deffnx procedure thread? object @returns{} boolean
@deffnx procedure thread-name thread @returns{} value
@deffnx procedure thread-uid thread @returns{} unique-integer-id
@code{Current-thread} returns the thread descriptor for the currently
running thread.  @code{Thread?} is the thread descriptor disjoint type
predicate.  @code{Thread-name} returns the name that was passed to
@code{spawn} when spawning @var{thread}, or @code{#f} if no name was
passed.  @code{Thread-uid} returns a thread descriptor's unique integer
identifier, assigned by the thread system.
@end deffn