GC API: Difference between revisions

533 bytes added ,  22 April 2008
gc_set_thread_affinity
m (→‎Decisions: typo)
(gc_set_thread_affinity)
Line 180: Line 180:
: At this point all marking has occurred. The callback function may synchronize external data structures by checking <tt>gc_get_markstate</tt>
: At this point all marking has occurred. The callback function may synchronize external data structures by checking <tt>gc_get_markstate</tt>
; GC_POST_SWEEP
; GC_POST_SWEEP
: At this point all sweeping has occurred, and the program is about to be resumed.
: At this point all sweeping has occurred, and the program is about to be resumed. Threads other than the main thread have not yet been restarted.
; GC_FINISHED
: At this point garbage collection is finished and threads have been resumed. Garbage collection will not occur again until this callback is complete. ''See {{bug|430290}} for rationale.''


  typedef void (*gc_callback)(
  typedef void (*gc_callback)(
Line 186: Line 188:


  void '''gc_add_callback'''(gc_callback callback);
  void '''gc_add_callback'''(gc_callback callback);
Register a callback function. If '''gc_set_thread_affinity''' has been called, the callback will occur on the specified thread.


'''Open issue:''' Need to document which callbacks may call which GC API functions.
'''Open issue:''' Need to document which callbacks may call which GC API functions.
Line 270: Line 274:


Equivalent to <code>{gc_suspend_request(heap); gc_resume_request(heap);}</code>.
Equivalent to <code>{gc_suspend_request(heap); gc_resume_request(heap);}</code>.
void '''gc_set_thread_affinity'''();
Inform the GC that all finalizers and callback functions should be called on the current thread.


== Tracing ==
== Tracing ==
Confirmed users, Bureaucrats and Sysops emeriti
1,217

edits