[Gc] Patch: proper error-handling for marker CreateThread and friends (Win32)

Ivan Maidanski ivmai at mail.ru
Tue Sep 15 12:53:43 PDT 2009


Hi!

This patch (ivmai140.diff), assuming ivmai138.diff is applied, adjusts GC_markers (and GC_parallel) values in case pthread_create/CreateThread/_beginthreadex() failure in start_mark_threads() (this could hardly ever occur except for WinCE which has limited memory space (say, 32 MiB) and th default stack size for each thread is 1 MiB (though, again, this shouldn't occur since GC_init() is typically called from WinMain() supplied by GC WinMain).

ChangeLog entries:

	* win32_threads.c (start_mark_threads): if pthread_create() is
	failed then don't try to create other marker threads and (after
	printing a warning) adjust GC_markers and GC_parallel values.
	* win32_threads.c (mark_mutex_event, builder_cv, mark_cv): Move
	the definition upper (to be visible in start_mark_threads()).
	* win32_threads.c (start_mark_threads): if CreateThread() or
	_beginthreadex() is failed then don't try to create other marker
	threads and (after printing a warning) adjust GC_markers,
	GC_parallel values, and destroy the event objects (either only
	some for the uncreated threads if DONT_USE_SIGNALANDWAIT or all if
	not a single thread is created).
	* win32_threads.c (GC_thr_init): Log GC_markers value (possibly
	adjusted) after start_mark_threads() call.

Bye.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ivmai140.diff
Type: application/octet-stream
Size: 3871 bytes
Desc: not available
Url : http://napali.hpl.hp.com/pipermail/gc/attachments/20090915/2884173f/ivmai140.obj


More information about the Gc mailing list