At Mon, 14 Sep 2020 00:34:08 -0500, Nate Griswold wrote: > If i understand correctly, in racket cs embedded if i am not currently > running anything in the main racket thread then gc cannot happen. But the > next time i make a call into racket on that reserved racket thread (which > has not been shut down, and by using racket_apply or some such) then gc can > happen. But i do not know about the other threads that racket has spawned.
In Racket CS, you can enable GC without the main thread by deactivating the thread. At the Racket level, use `#blocking? #t` for a foreign function to deactivate the current thread while calling the function. At the C level, you can use `Sdeactivate_thread` and `Sactivate_therad` from Chez Scheme's API. Racket BC doesn't have a notation of deactivating a thread. Most GCs with BC can run in separate places even without the main thread active, but the main thread is needed when there has been enough shared-space allocation that all threads must be involved. One caution for both CS and BC, though: Some foreign-library bindings use `#:in-original-place?` to make use of the foreign library single-threaded by routing all calls through the main place. That requires the main thread to be active. Matthew -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20200914054728.38c%40sirmail.smtps.cs.utah.edu.

