diff options
author | ivmai <ivmai> | 2009-09-16 14:43:37 +0000 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2011-07-26 21:06:46 +0400 |
commit | db2565100a193fa71336be2951b342ef7596f828 (patch) | |
tree | 4214eb726e4912fa34628655dc41ae247213caf8 /gc_dlopen.c | |
parent | d70b0280af3c3d53e2a794b26aa7a3127943b8c3 (diff) | |
download | bdwgc-db2565100a193fa71336be2951b342ef7596f828.tar.gz |
2009-09-16 Ivan Maidanski <ivmai@mail.ru>
* ChangeLog: Remove trailing spaces at EOLn; insert blank lines
where missed.
* doc/README: Expand all tabs to spaces; remove trailing spaces at
EOLn; remove multiple trailing blank lines.
* doc/README.autoconf: Ditto.
* doc/README.DGUX386: Ditto.
* doc/README.environment: Ditto.
* doc/README.macros: Ditto.
* doc/README.win32: Ditto.
* tests/test.c: Ditto.
* tests/test_cpp.cc: Ditto.
* backgraph.c: Ditto.
* blacklst.c: Ditto.
* checksums.c: Ditto.
* darwin_stop_world.c: Ditto.
* dbg_mlc.c: Ditto.
* dyn_load.c: Ditto.
* finalize.c: Ditto.
* gc_dlopen.c: Ditto.
* gcj_mlc.c: Ditto.
* headers.c: Ditto.
* mach_dep.c: Ditto.
* malloc.c: Ditto.
* mallocx.c: Ditto.
* new_hblk.c: Ditto.
* obj_map.c: Ditto.
* ptr_chck.c: Ditto.
* real_malloc.c: Ditto.
* reclaim.c: Ditto.
* stubborn.c: Ditto.
* thread_local_alloc.c: Ditto.
* typd_mlc.c: Ditto.
* gc_cpp.cc: Ditto.
* include/gc_allocator.h: Ditto.
* include/gc_backptr.h: Ditto.
* include/gc_config_macros.h: Ditto.
* include/gc_cpp.h: Ditto.
* include/gc_gcj.h: Ditto.
* include/gc_inline.h: Ditto.
* include/gc_mark.h: Ditto.
* include/gc_pthread_redirects.h: Ditto.
* include/gc_typed.h: Ditto.
* include/gc_version.h: Ditto.
* include/javaxfc.h: Ditto.
* include/new_gc_alloc.h: Ditto.
* include/private/darwin_semaphore.h: Ditto.
* include/private/dbg_mlc.h: Ditto.
* include/private/gc_hdrs.h: Ditto.
* include/private/gc_locks.h: Ditto.
* include/private/gc_pmark.h: Ditto.
* include/private/gcconfig.h: Ditto.
* include/private/pthread_support.h: Ditto.
* include/private/thread_local_alloc.h: Ditto.
* darwin_stop_world.c: Add copyright header.
* include/gc_backptr.h: Ditto.
* include/gc_config_macros.h: Ditto.
* include/gc_pthread_redirects.h: Ditto.
* include/gc_version.h: Ditto.
* include/javaxfc.h: Ditto.
* include/private/darwin_semaphore.h: Ditto.
* include/private/pthread_support.h: Ditto.
* gc_cpp.cc: Make copyright header uniform across the package.
* include/gc_cpp.h: Ditto.
Diffstat (limited to 'gc_dlopen.c')
-rw-r--r-- | gc_dlopen.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/gc_dlopen.c b/gc_dlopen.c index 69abfbe1..c0ca658a 100644 --- a/gc_dlopen.c +++ b/gc_dlopen.c @@ -39,28 +39,28 @@ GC_bool GC_collection_in_progress(void); - /* Make sure we're not in the middle of a collection, and make */ - /* sure we don't start any. Returns previous value of GC_dont_gc. */ - /* This is invoked prior to a dlopen call to avoid synchronization */ - /* issues. We can't just acquire the allocation lock, since startup */ - /* code in dlopen may try to allocate. */ - /* This solution risks heap growth in the presence of many dlopen */ - /* calls in either a multithreaded environment, or if the library */ - /* initialization code allocates substantial amounts of GC'ed memory. */ - /* But I don't know of a better solution. */ + /* Make sure we're not in the middle of a collection, and make */ + /* sure we don't start any. Returns previous value of GC_dont_gc. */ + /* This is invoked prior to a dlopen call to avoid synchronization */ + /* issues. We can't just acquire the allocation lock, since startup */ + /* code in dlopen may try to allocate. */ + /* This solution risks heap growth in the presence of many dlopen */ + /* calls in either a multithreaded environment, or if the library */ + /* initialization code allocates substantial amounts of GC'ed memory. */ + /* But I don't know of a better solution. */ static void disable_gc_for_dlopen(void) { LOCK(); while (GC_incremental && GC_collection_in_progress()) { - GC_collect_a_little_inner(1000); + GC_collect_a_little_inner(1000); } ++GC_dont_gc; UNLOCK(); } - /* Redefine dlopen to guarantee mutual exclusion with */ - /* GC_register_dynamic_libraries. */ - /* Should probably happen for other operating systems, too. */ + /* Redefine dlopen to guarantee mutual exclusion with */ + /* GC_register_dynamic_libraries. */ + /* Should probably happen for other operating systems, too. */ #include <dlfcn.h> @@ -75,7 +75,7 @@ GC_API void * WRAP_FUNC(dlopen)(const char *path, int mode) { void * result; - + # ifndef USE_PROC_FOR_LIBRARIES disable_gc_for_dlopen(); # endif @@ -86,6 +86,3 @@ GC_API void * WRAP_FUNC(dlopen)(const char *path, int mode) return(result); } # endif /* GC_PTHREADS || GC_SOLARIS_THREADS ... */ - - - |