typedef long GC_signed_word;
#endif
-/* Get the GC library version. The returned value is in the form: */
-/* ((version_major<<16) | (version_minor<<8) | alpha_version). */
+/* Get the GC library version. The returned value is a constant in the */
+/* form: ((version_major<<16) | (version_minor<<8) | alpha_version). */
GC_API unsigned GC_CALL GC_get_version(void);
/* Public read-only variables */
GC_API GC_word GC_gc_no;/* Counter incremented per collection. */
/* Includes empty GCs at startup. */
GC_API GC_word GC_CALL GC_get_gc_no(void);
- /* GC_get_gc_no() uses no synchronization, so */
+ /* GC_get_gc_no() is unsynchronized, so */
/* it requires GC_call_with_alloc_lock() to */
/* avoid data races on multiprocessors. */
/* GC_NPROC is not set and this is an MP. */
/* If GC_parallel is set, incremental */
/* collection is only partially functional, */
- /* and may not be desirable. */
+ /* and may not be desirable. This getter does */
+ /* not use or need synchronization (i.e. */
+ /* acquiring the GC lock). */
GC_API int GC_CALL GC_get_parallel(void);
#endif
/* deallocated with GC_free. Initial value */
/* is determined by FIND_LEAK macro. */
/* The value should not typically be modified */
- /* after GC initialization. */
+ /* after GC initialization (and, thus, it does */
+ /* not use or need synchronization). */
GC_API void GC_CALL GC_set_find_leak(int);
GC_API int GC_CALL GC_get_find_leak(void);
GC_API int GC_all_interior_pointers;
/* Arrange for pointers to object interiors to */
- /* be recognized as valid. May not be changed */
- /* after GC initialization. The initial value */
+ /* be recognized as valid. Typically should */
+ /* not be changed after GC initialization (in */
+ /* case of calling it after the GC is */
+ /* initialized, the setter acquires the GC lock */
+ /* (to avoid data races). The initial value */
/* depends on whether the GC is built with */
/* ALL_INTERIOR_POINTERS macro defined or not. */
/* Unless DONT_ADD_BYTE_AT_END is defined, this */
/* also affects whether sizes are increased by */
/* at least a byte to allow "off the end" */
- /* pointer recognition. */
- /* MUST BE 0 or 1. */
+ /* pointer recognition. Must be only 0 or 1. */
GC_API void GC_CALL GC_set_all_interior_pointers(int);
GC_API int GC_CALL GC_get_all_interior_pointers(void);
/* manually initialize the root set */
/* before the first collection. */
/* Interferes with blacklisting. */
- /* Wizards only. */
+ /* Wizards only. The setter and getter */
+ /* are unsynchronized (and no external */
+ /* locking is needed since the value is */
+ /* accessed at GC initialization only). */
GC_API void GC_CALL GC_set_dont_precollect(int);
GC_API int GC_CALL GC_get_dont_precollect(void);
GC_API void GC_CALL GC_set_pages_executable(int);
/* Returns non-zero value if the GC is set to the allocate-executable */
-/* mode. The mode could be changed by GC_set_pages_executable() unless */
-/* the latter has no effect on the platform. */
+/* mode. The mode could be changed by GC_set_pages_executable (before */
+/* GC_INIT) unless the former has no effect on the platform. Does not */
+/* use or need synchronization (i.e. acquiring the allocator lock). */
GC_API int GC_CALL GC_get_pages_executable(void);
/* Initialize the collector. Portable clients should call GC_INIT() */
/* Limit the heap size to n bytes. Useful when you're debugging, */
/* especially on systems that don't handle running out of memory well. */
-/* n == 0 ==> unbounded. This is the default. */
+/* n == 0 ==> unbounded. This is the default. This setter function is */
+/* unsynchronized (so it might require GC_call_with_alloc_lock to avoid */
+/* data races). */
GC_API void GC_CALL GC_set_max_heap_size(GC_word /* n */);
/* Inform the collector that a certain section of statically allocated */
/* Set and get the default stop_func. The default stop_func is used by */
/* GC_gcollect() and by implicitly trigged collections (except for the */
/* case when handling out of memory). Must not be 0. */
+/* Both the setter and getter acquire the GC lock to avoid data races. */
GC_API void GC_CALL GC_set_stop_func(GC_stop_func /* stop_func */);
GC_API GC_stop_func GC_CALL GC_get_stop_func(void);
/* like the JNI AttachCurrentThread in an environment in which new */
/* threads are not automatically registered with the collector. */
/* It is also unfortunately hard to implement well on many platforms. */
-/* Returns GC_SUCCESS or GC_UNIMPLEMENTED. */
+/* Returns GC_SUCCESS or GC_UNIMPLEMENTED. This function acquires the */
+/* GC lock on some platforms. */
GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *);
/* The following routines are primarily intended for use with a */
/* Public setter and getter for switching "unmap as much as possible" */
/* mode on(1) and off(0). Has no effect unless unmapping is turned on. */
/* Has no effect on implicitly-initiated garbage collections. Initial */
-/* value is controlled by GC_FORCE_UNMAP_ON_GCOLLECT. */
+/* value is controlled by GC_FORCE_UNMAP_ON_GCOLLECT. The setter and */
+/* getter are unsynchronized. */
GC_API void GC_CALL GC_set_force_unmap_on_gcollect(int);
GC_API int GC_CALL GC_get_force_unmap_on_gcollect(void);