[Gc] Comment on Mono GC_thread_is_registered

Ivan Maidanski ivmai at mail.ru
Mon Sep 14 01:39:54 PDT 2009


Hi!

As I see, Mono also has GC_thread_is_registered() in its gc.h (but I've failed to find out where it (or its wrapper - mono_gc_is_gc_thread) is actually used).

This could be easily added to our gc.h but I don't think it's worth cause:
- of little use (IMHO);
- easily emulated using thread register/unregister (with some performance loss):

int GC_thread_is_registered(void) // or GC_thread_is_my_registered
{
 // assumes GC already entered multi-threaded mode
 struct GC_stack_base sb;
 sb.mem_base = &sb; // no need to call GC_call_with_stack_base() here (even on IA64)
 if (GC_register_my_thread(&sb) == GC_SUCCESS) {
   (void)GC_unregister_my_thread();
   return 0;
 }
 /* GC_DUPLICATE */
 return 1; /* is registered */
}

Bye.


More information about the Gc mailing list