* threads, mux and single-slot values
@ 2007-03-14 5:31 Marco Maggi
0 siblings, 0 replies; only message in thread
From: Marco Maggi @ 2007-03-14 5:31 UTC (permalink / raw)
To: guile-user
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
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-03-14 5:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-14 5:31 threads, mux and single-slot values Marco Maggi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).