[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
17.3.4 Condition Variables
Posix thread condition variables follows the common thread API (see Thread Common Functions).
(module example (library pthread) (main main)) (define (main argv) (let ((res #f) (lock (make-mutex)) (cv (make-condition-variable))) (thread-join! (thread-start-joinable! (instantiate::pthread (body (lambda () (mutex-lock! lock) (thread-start! (instantiate::pthread (body (lambda () (mutex-lock! lock) (condition-variable-signal! cv) (mutex-unlock! lock))))) (condition-variable-wait! cv lock) (set! res 23) (mutex-unlock! lock)))))) res))
This document was generated on March 31, 2014 using texi2html 5.0.