GC API: Difference between revisions

107 bytes removed ,  8 April 2008
Line 201: Line 201:
  #define '''GC_FAST_RESUME_REQUEST'''(heap) ...
  #define '''GC_FAST_RESUME_REQUEST'''(heap) ...


These are macros such that anywhere a C/C++ statement would be legal, the idiom
These are macros such that this code:
<pre style="border: none; padding: none; background-color: transparent">GC_FAST_SUSPEND_REQUEST(expr);
&lt;statements&gt;
GC_FAST_RESUME_REQUEST(expr);</pre>


GC_FAST_SUSPEND_REQUEST(expr);
expands to a C/C++ statement that behaves like this one:
...
<pre style="border: none; padding: none; background-color: transparent">{
... (0 or more C/C++ statements)
    gc_suspend_request(heap);
...
    &lt;statements&gt;
GC_FAST_RESUME_REQUEST(expr);
    gc_resume_request(heap);
 
}</pre>
is also legal and expands to a C/C++ statement that behaves like this one:
 
{
    gc_suspend_request(heap);
    ...
    ... (the statements)
    ...
    gc_resume_request(heap);
}
 
except that


except that:
* in C++, <code>gc_resume_request</code> must called even if an exception is thrown; and
* in C++, <code>gc_resume_request</code> must called even if an exception is thrown; and
* the behavior is undefined if the statements contain any identifier starting with <code>_gc_</code>.
* the behavior is undefined if the ''&lt;statements&gt;'' contain any identifier starting with <code>_gc_</code>.


Note that the call to <code>GC_FAST_SUSPEND_REQUEST</code> must be followed by a matching call to <code>GC_FAST_RESUME_REQUEST</code> in the same C/C++ block.  If these macros are used any other way, the result is undefined.
If either macro is used any other way, the result is undefined.


  void '''gc_yield_request'''(GCHeap heap);
  void '''gc_yield_request'''(GCHeap heap);
638

edits