Avoid "warning: The macro `AC_DECL_SYS_SIGLIST' is obsolete".
[gnulib.git] / lib / windows-thread.h
blob90da7bdcf43b5b632086b0f5dbf301f693ca9b54
1 /* Creating and controlling threads (native Windows implementation).
2 Copyright (C) 2005-2020 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2005.
18 Based on GCC's gthr-win32.h. */
20 #ifndef _WINDOWS_THREAD_H
21 #define _WINDOWS_THREAD_H
23 #define WIN32_LEAN_AND_MEAN /* avoid including junk */
24 #include <windows.h>
26 /* The glwthread_thread_t is a pointer to a structure in memory.
27 Why not the thread handle? If it were the thread handle, it would be hard
28 to implement glwthread_thread_self() (since GetCurrentThread () returns a
29 pseudo-handle, DuplicateHandle (GetCurrentThread ()) returns a handle that
30 must be closed afterwards, and there is no function for quickly retrieving
31 a thread handle from its id).
32 Why not the thread id? I tried it. It did not work: Sometimes ids appeared
33 that did not belong to running threads, and glthread_join failed with ESRCH.
35 typedef struct glwthread_thread_struct *glwthread_thread_t;
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
41 /* attr is a bit mask, consisting of the following bits: */
42 #define GLWTHREAD_ATTR_DETACHED 1
43 extern int glwthread_thread_create (glwthread_thread_t *threadp,
44 unsigned int attr,
45 void * (*func) (void *), void *arg);
46 extern int glwthread_thread_join (glwthread_thread_t thread, void **retvalp);
47 extern int glwthread_thread_detach (glwthread_thread_t thread);
48 extern glwthread_thread_t glwthread_thread_self (void);
49 extern _Noreturn void glwthread_thread_exit (void *retval);
51 #ifdef __cplusplus
53 #endif
55 #endif /* _WINDOWS_THREAD_H */