Blame gl/tests/windows-thread.h

Packit Service 991b93
/* Creating and controlling threads (native Windows implementation).
Packit Service 991b93
   Copyright (C) 2005-2020 Free Software Foundation, Inc.
Packit Service 991b93
Packit Service 991b93
   This program is free software; you can redistribute it and/or modify
Packit Service 991b93
   it under the terms of the GNU General Public License as published by
Packit Service 991b93
   the Free Software Foundation; either version 3, or (at your option)
Packit Service 991b93
   any later version.
Packit Service 991b93
Packit Service 991b93
   This program is distributed in the hope that it will be useful,
Packit Service 991b93
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 991b93
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 991b93
   GNU General Public License for more details.
Packit Service 991b93
Packit Service 991b93
   You should have received a copy of the GNU General Public License
Packit Service 991b93
   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
Packit Service 991b93
Packit Service 991b93
/* Written by Bruno Haible <bruno@clisp.org>, 2005.
Packit Service 991b93
   Based on GCC's gthr-win32.h.  */
Packit Service 991b93
Packit Service 991b93
#ifndef _WINDOWS_THREAD_H
Packit Service 991b93
#define _WINDOWS_THREAD_H
Packit Service 991b93
Packit Service 991b93
#define WIN32_LEAN_AND_MEAN  /* avoid including junk */
Packit Service 991b93
#include <windows.h>
Packit Service 991b93
Packit Service 991b93
/* The glwthread_thread_t is a pointer to a structure in memory.
Packit Service 991b93
   Why not the thread handle?  If it were the thread handle, it would be hard
Packit Service 991b93
   to implement glwthread_thread_self() (since GetCurrentThread () returns a
Packit Service 991b93
   pseudo-handle, DuplicateHandle (GetCurrentThread ()) returns a handle that
Packit Service 991b93
   must be closed afterwards, and there is no function for quickly retrieving
Packit Service 991b93
   a thread handle from its id).
Packit Service 991b93
   Why not the thread id?  I tried it.  It did not work: Sometimes ids appeared
Packit Service 991b93
   that did not belong to running threads, and glthread_join failed with ESRCH.
Packit Service 991b93
 */
Packit Service 991b93
typedef struct glwthread_thread_struct *glwthread_thread_t;
Packit Service 991b93
Packit Service 991b93
#ifdef __cplusplus
Packit Service 991b93
extern "C" {
Packit Service 991b93
#endif
Packit Service 991b93
Packit Service 991b93
/* attr is a bit mask, consisting of the following bits: */
Packit Service 991b93
#define GLWTHREAD_ATTR_DETACHED 1
Packit Service 991b93
extern int glwthread_thread_create (glwthread_thread_t *threadp,
Packit Service 991b93
                                    unsigned int attr,
Packit Service 991b93
                                    void * (*func) (void *), void *arg);
Packit Service 991b93
extern int glwthread_thread_join (glwthread_thread_t thread, void **retvalp);
Packit Service 991b93
extern int glwthread_thread_detach (glwthread_thread_t thread);
Packit Service 991b93
extern glwthread_thread_t glwthread_thread_self (void);
Packit Service 991b93
extern int glwthread_thread_exit (void *retval);
Packit Service 991b93
Packit Service 991b93
#ifdef __cplusplus
Packit Service 991b93
}
Packit Service 991b93
#endif
Packit Service 991b93
Packit Service 991b93
#endif /* _WINDOWS_THREAD_H */