445 |
etc. |
etc. |
446 |
@end deftp |
@end deftp |
447 |
|
|
448 |
@deftypefun {C Function} int scm_thread_create (scm_t_thread *t, void (*proc)(void *), void *data) |
@deftypefn {C Function} int scm_thread_create (scm_t_thread *t, void (*proc)(void *), void *data) |
449 |
Create a new thread that will start by calling @var{proc}, passing it |
Create a new thread that will start by calling @var{proc}, passing it |
450 |
@var{data}. A handle for the new thread is stored in @var{t}, which |
@var{data}. A handle for the new thread is stored in @var{t}, which |
451 |
must be non-NULL. The thread terminated when @var{proc} returns. |
must be non-NULL. The thread terminated when @var{proc} returns. |
453 |
is has terminated so that it can be used with @var{scm_thread_join}, |
is has terminated so that it can be used with @var{scm_thread_join}, |
454 |
for example. When it has been detached, the handle becomes invalid as |
for example. When it has been detached, the handle becomes invalid as |
455 |
soon as the thread terminates. |
soon as the thread terminates. |
456 |
@end deftypefun |
@end deftypefn |
457 |
|
|
458 |
@deftypefun {C Function} void scm_thread_detach (scm_t_thread t) |
@deftypefn {C Function} void scm_thread_detach (scm_t_thread t) |
459 |
Detach the thread @var{t}. See @code{scm_thread_create}. |
Detach the thread @var{t}. See @code{scm_thread_create}. |
460 |
@end deftypefun |
@end deftypefn |
461 |
|
|
462 |
@deftypefun {C Function} void scm_thread_join (scm_t_thread t) |
@deftypefn {C Function} void scm_thread_join (scm_t_thread t) |
463 |
Wait for thread @var{t} to terminate. The thread must not have been |
Wait for thread @var{t} to terminate. The thread must not have been |
464 |
detached at the time that @code{scm_thread_join} is called, but it |
detached at the time that @code{scm_thread_join} is called, but it |
465 |
might have been detached by the time it terminates. |
might have been detached by the time it terminates. |
466 |
@end deftypefun |
@end deftypefn |
467 |
|
|
468 |
@deftypefun {C Function} scm_t_thread scm_thread_self () |
@deftypefn {C Function} scm_t_thread scm_thread_self () |
469 |
Return the handle of the calling thread. |
Return the handle of the calling thread. |
470 |
@end deftypefun |
@end deftypefn |
471 |
|
|
472 |
@deftp {C Data Type} scm_t_mutex |
@deftp {C Data Type} scm_t_mutex |
473 |
This data type represents a mutex, to be used with scm_mutex_init, |
This data type represents a mutex, to be used with scm_mutex_init, |
474 |
etc. |
etc. |
475 |
@end deftp |
@end deftp |
476 |
|
|
477 |
@deftypefun {C Function} void scm_mutex_init (scm_t_mutex *m) |
@deftypefn {C Function} void scm_mutex_init (scm_t_mutex *m) |
478 |
Initialize the mutex structure pointed to by @var{m}. |
Initialize the mutex structure pointed to by @var{m}. |
479 |
@end deftypefun |
@end deftypefn |
480 |
|
|
481 |
@deftypefun {C Function} void scm_mutex_destroy (scm_t_mutex *m) |
@deftypefn {C Function} void scm_mutex_destroy (scm_t_mutex *m) |
482 |
Deallocate all resources associated with @var{m}. |
Deallocate all resources associated with @var{m}. |
483 |
@end deftypefun |
@end deftypefn |
484 |
|
|
485 |
@deftypefun {C Function} void scm_mutex_lock (scm_t_mutex *m) |
@deftypefn {C Function} void scm_mutex_lock (scm_t_mutex *m) |
486 |
Lock the mutex @var{m}. When it is already locked by a different |
Lock the mutex @var{m}. When it is already locked by a different |
487 |
thread, wait until it becomes available. Locking a mutex that is |
thread, wait until it becomes available. Locking a mutex that is |
488 |
already locked by the current threads is not allowd and results in |
already locked by the current threads is not allowd and results in |
489 |
undefined behavior. The mutices are not guaranteed to be fair. That |
undefined behavior. The mutices are not guaranteed to be fair. That |
490 |
is, a thread that attempts a lock after yourself might be granted it |
is, a thread that attempts a lock after yourself might be granted it |
491 |
before you. |
before you. |
492 |
@end deftypefun |
@end deftypefn |
493 |
|
|
494 |
@deftypefun {C Function} int scm_mutex_trylock (scm_t_mutex *m) |
@deftypefn {C Function} int scm_mutex_trylock (scm_t_mutex *m) |
495 |
Lock @var{m} as with @code{scm_mutex_lock} but don't wait when this |
Lock @var{m} as with @code{scm_mutex_lock} but don't wait when this |
496 |
does succeed immediately. Returns non-zero when the mutex could in |
does succeed immediately. Returns non-zero when the mutex could in |
497 |
fact be locked , and zero when it is already locked by some other |
fact be locked , and zero when it is already locked by some other |
498 |
thread. |
thread. |
499 |
@end deftypefun |
@end deftypefn |
500 |
|
|
501 |
@deftypefun {C Function} void scm_mutex_unlock (scm_t_mutex *m) |
@deftypefn {C Function} void scm_mutex_unlock (scm_t_mutex *m) |
502 |
Unlock the mutex @var{m}. The mutex must have been locked by the |
Unlock the mutex @var{m}. The mutex must have been locked by the |
503 |
current thread, else the behavior is undefined. |
current thread, else the behavior is undefined. |
504 |
@end deftypefun |
@end deftypefn |
505 |
|
|
506 |
@deftp {C Data Type} scm_t_cond |
@deftp {C Data Type} scm_t_cond |
507 |
This data type represents a condition variable, to be used with |
This data type represents a condition variable, to be used with |
508 |
scm_cond_init, etc. |
scm_cond_init, etc. |
509 |
@end deftp |
@end deftp |
510 |
|
|
511 |
@deftypefun {C Function} void scm_cond_init (scm_t_cond *c) |
@deftypefn {C Function} void scm_cond_init (scm_t_cond *c) |
512 |
Initialize the mutex structure pointed to by @var{c}. |
Initialize the mutex structure pointed to by @var{c}. |
513 |
@end deftypefun |
@end deftypefn |
514 |
|
|
515 |
@deftypefun {C Function} void scm_cond_destroy (scm_t_cond *c) |
@deftypefn {C Function} void scm_cond_destroy (scm_t_cond *c) |
516 |
Deallocate all resources associated with @var{c}. |
Deallocate all resources associated with @var{c}. |
517 |
@end deftypefun |
@end deftypefn |
518 |
|
|
519 |
@deftypefun {C Function} void scm_cond_wait (scm_t_cond *c, scm_t_mutex *m) |
@deftypefn {C Function} void scm_cond_wait (scm_t_cond *c, scm_t_mutex *m) |
520 |
Wait for @var{c} to be signalled. While waiting @var{m} is unlocked |
Wait for @var{c} to be signalled. While waiting @var{m} is unlocked |
521 |
and locked again before @code{scm_cond_wait} returns. |
and locked again before @code{scm_cond_wait} returns. |
522 |
@end deftypefun |
@end deftypefn |
523 |
|
|
524 |
@deftypefun {C Function} void scm_cond_timedwait (scm_t_cond *c, scm_t_mutex *m, timespec *abstime) |
@deftypefn {C Function} void scm_cond_timedwait (scm_t_cond *c, scm_t_mutex *m, timespec *abstime) |
525 |
Wait for @var{c} to be signalled as with @code{scm_cond_wait} but |
Wait for @var{c} to be signalled as with @code{scm_cond_wait} but |
526 |
don't wait longer than the point in time specified by @var{abstime}. |
don't wait longer than the point in time specified by @var{abstime}. |
527 |
when the waiting is aborted, zero is returned; non-zero else. |
when the waiting is aborted, zero is returned; non-zero else. |
528 |
@end deftypefun |
@end deftypefn |
529 |
|
|
530 |
@deftypefun {C Function} void scm_cond_signal (scm_t_cond *c) |
@deftypefn {C Function} void scm_cond_signal (scm_t_cond *c) |
531 |
Signal the condition variable @var{c}. When one or more threads are |
Signal the condition variable @var{c}. When one or more threads are |
532 |
waiting for it to be signalled, select one arbitrarily and let its |
waiting for it to be signalled, select one arbitrarily and let its |
533 |
wait succeed. |
wait succeed. |
534 |
@end deftypefun |
@end deftypefn |
535 |
|
|
536 |
@deftypefun {C Function} void scm_cond_broadcast (scm_t_cond *c) |
@deftypefn {C Function} void scm_cond_broadcast (scm_t_cond *c) |
537 |
Signal the condition variable @var{c}. When there are threads waiting |
Signal the condition variable @var{c}. When there are threads waiting |
538 |
for it to be signalled, wake them all up and make all their waits |
for it to be signalled, wake them all up and make all their waits |
539 |
succeed. |
succeed. |
540 |
@end deftypefun |
@end deftypefn |
541 |
|
|
542 |
@deftp {C Type} scm_t_key |
@deftp {C Type} scm_t_key |
543 |
This type represents a key for a thread-specific value. |
This type represents a key for a thread-specific value. |
544 |
@end deftp |
@end deftp |
545 |
|
|
546 |
@deftypefun {C Function} void scm_key_create (scm_t_key *keyp) |
@deftypefn {C Function} void scm_key_create (scm_t_key *keyp) |
547 |
Create a new key for a thread-specific value. Each thread has its own |
Create a new key for a thread-specific value. Each thread has its own |
548 |
value associated to such a handle. The new handle is stored into |
value associated to such a handle. The new handle is stored into |
549 |
@var{keyp}, which must be non-NULL. |
@var{keyp}, which must be non-NULL. |
550 |
@end deftypefun |
@end deftypefn |
551 |
|
|
552 |
@deftypefun {C Function} void scm_key_delete (scm_t_key key) |
@deftypefn {C Function} void scm_key_delete (scm_t_key key) |
553 |
This function makes @var{key} invalid as a key for thread-specific data. |
This function makes @var{key} invalid as a key for thread-specific data. |
554 |
@end deftypefun |
@end deftypefn |
555 |
|
|
556 |
@deftypefun {C Function} void scm_key_setspecific (scm_t_key key, const void *value) |
@deftypefn {C Function} void scm_key_setspecific (scm_t_key key, const void *value) |
557 |
Associate @var{value} with @var{key} in the calling thread. |
Associate @var{value} with @var{key} in the calling thread. |
558 |
@end deftypefun |
@end deftypefn |
559 |
|
|
560 |
@deftypefun {C Function} int scm_key_getspecific (scm_t_key key) |
@deftypefn {C Function} int scm_key_getspecific (scm_t_key key) |
561 |
Return the value currently associated with @var{key} in the calling |
Return the value currently associated with @var{key} in the calling |
562 |
thread. When @code{scm_key_setspecific} has not yet been called in |
thread. When @code{scm_key_setspecific} has not yet been called in |
563 |
this thread with this key, @code{NULL} is returned. |
this thread with this key, @code{NULL} is returned. |
564 |
@end deftypefun |
@end deftypefn |
565 |
|
|
566 |
@deftypefun {C Function} int scm_thread_select (...) |
@deftypefn {C Function} int scm_thread_select (...) |
567 |
This function does the same thing as the system's @code{select} |
This function does the same thing as the system's @code{select} |
568 |
function, but in a way that is friendly to the thread implementation. |
function, but in a way that is friendly to the thread implementation. |
569 |
You should call it in preference to the system @code{select}. |
You should call it in preference to the system @code{select}. |
570 |
@end deftypefun |
@end deftypefn |
571 |
|
|
572 |
@node Fluids |
@node Fluids |
573 |
@section Fluids |
@section Fluids |