Say two Gambit threads that execute concurrently in two different OS threads, are communicating by mutating a structure. E.g.
Global:
(define itc-state:set? #f)
(define itc-state:message #f)
Thread 1 does:
(set! itc-state:message ..something..)
(set! itc-state:set? #t)
And thread 2 polls:
(do loop ()
(if itc-state:set? (act-on! itc-state:message))
(loop))
Is any direct polling of structures between OS threads illegal in SMP Gambit, or what is the intended way for this to be coherent?
(If this was ordinary C code, on a weakly ordered architecture, the worry would be that the |itc-state:set?| update would reach the other CPU core before the |itc-state:message| update reached it and that the program hence would enter into an undefined state - and for this reason programs do a write barrier between.)