[Gc] GC and Coroutines in multiple threads
"Juan Wajnerman" <[email protected]> Mon, 21 Sep 2015 20:24:27 -0700 (PDT)
| Newsgroups | gmane.comp.programming.garbage-collection.boehmgc |
|---|---|
| Message-ID | <1442892267122.4548ecf@Nodemailer> |
Long time ago, I opened a discussion about using the GC with coroutines (using libpcl): https://lists.opendylan.org/pipermail/bdwgc/2014-January/005819.html Eventually I solved the problem, by setting GC_stackbottom to the right value before jumping to a different coroutine, and then making sure all coroutine stacks are visited during GC. The code is in Crystal language but I think it’s easy to understand even if you don’t know the language: https://github.com/manastech/crystal/blob/master/src/fiber/fiber.cr This works perfectly fine as long as a single thread is used, but now we want to to take this to the next level and have coroutines in multiple threads. As far as I understand, GC_stackbottom only serves for the main thread. For other threads, this value is stored in GC_thread.stack_end. However this is not part of the public API. The only public function that can actually make changes to this value seems to be GC_call_with_gc_active. However, this is not useful for coroutines, because I need to set back the value once the coroutine is resumed, so this doesn’t work with the callback style that this API have to offer. Do you think it’s possible to add some public API to expose this functionality? I could work on this and send a PR. For example, adding a function like: GC_set_current_thread_stack_end(ptr_t). Best regards! - Juan _______________________________________________ bdwgc mailing list [email protected] https://lists.opendylan.org/mailman/listinfo/bdwgc