[gambit-list] FFI, returning values, thread safety

Michael South msouth at msouth.org
Wed Sep 19 07:41:03 EDT 2007


I have a question about the C interface. It appears necessary to
decrement the reference count of ___STILL objects before returning them:

___SCMOBJ foo()
{
  ___SCMOBJ result;
  ___EXT(___CHARSTRING_to_SCMOBJ) ("hello", &result, 0);
  ___release_scmobj (result);
  return result;
}

Why is there not a race condition between decrementing the reference
count (___release_scmobj) and returning the result? What if another
thread wakes up the GC in the meantime?
-- 
Michael South <msouth at msouth.org>



More information about the Gambit-list mailing list