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

Reply via email to