Thread (12 messages) 12 messages, 6 authors, 2016-10-28

Re: [PATCH] compat: Allow static initializer for pthreads on Windows

From: Stefan Beller <hidden>
Date: 2016-10-27 21:59:17
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

there isn't really a great place to put a dynamic initialization.
Answering this question specifically (Where to put it?),
I am about to send out a patch that puts it in compat/mingw.c:2232:
diff --git a/compat/mingw.c b/compat/mingw.c
index 3fbfda5..9881c3d 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2232,6 +2232,9 @@ void mingw_startup(void)
         /* initialize critical section for waitpid pinfo_t list */
         InitializeCriticalSection(&pinfo_cs);

+        /* initialize critical sections in the attr code */
+        start_attr();
+
         /* set up default file mode and file modes for stdin/out/err */
         _fmode = _O_BINARY;
         _setmode(_fileno(stdin), _O_BINARY);
If I understood Johannes correctly this is the place to put it.
Junio seems to be ok with static mutex init for non windows platforms,
so I put it into the mingw specifc startup code.

Thanks,
Stefan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help