[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
threads, mux and single-slot values
From: |
Marco Maggi |
Subject: |
threads, mux and single-slot values |
Date: |
Wed, 14 Mar 2007 06:31:04 +0100 |
Ciao,
when a variable in the "store" is shared among threads: is
it safe to access it without mutual exclusion?
When I want to mutate a multiple-slot value that is shared
among threads, I use a mutex or a system async. Fine.
But if the shared value is a single LET variable, say
holding a boolean, and I just want to test it for trueness
and set it to #t or #f: do I have to use an async?
The specific case I am interested with looks (somewhat)
like:
(use-modules (ice-9 threads))
(let ((flag #f))
(define tid (begin-thread
...
(if flag
...)
...))
...
(set! flag #t)
...
(join-thread tid))
and it works like I expect it to in a test suite, but is it
correct?
P.S. Guile doc: '1+' is undocumented.
--
Marco Maggi
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- threads, mux and single-slot values,
Marco Maggi <=