Changeset: c03e78514264 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c03e78514264
Modified Files:
gdk/gdk_system.c
Branch: Jun2016
Log Message:
In join_detached_threads on Windows, only wait for detached threads.
diffs (39 lines):
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -237,18 +237,25 @@ void
join_detached_threads(void)
{
struct winthread *w;
+ int waited;
- EnterCriticalSection(&winthread_cs);
- while (winthreads) {
- w = winthreads;
- winthreads = w->next;
+ do {
+ waited = 0;
+ EnterCriticalSection(&winthread_cs);
+ for (w = winthreads; w; w = w->next) {
+ if ((w->flags & (DETACHED | WAITING)) == DETACHED) {
+ w->flags |= WAITING;
+ LeaveCriticalSection(&winthread_cs);
+ WaitForSingleObject(w->hdl, INFINITE);
+ CloseHandle(w->hdl);
+ rm_winthread(w);
+ waited = 1;
+ EnterCriticalSection(&winthread_cs);
+ break;
+ }
+ }
LeaveCriticalSection(&winthread_cs);
- WaitForSingleObject(w->hdl, INFINITE);
- CloseHandle(w->hdl);
- free(w);
- EnterCriticalSection(&winthread_cs);
- }
- LeaveCriticalSection(&winthread_cs);
+ } while (waited);
}
int
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list