2002-08-01 18:20:31 +02:00
|
|
|
/* cygthread.h
|
|
|
|
|
2004-01-19 06:46:54 +01:00
|
|
|
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.
|
2002-08-01 18:20:31 +02:00
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
2004-11-26 05:15:10 +01:00
|
|
|
#ifndef _CYGTHREAD_H
|
|
|
|
#define _CYGTHREAD_H
|
|
|
|
|
2002-08-01 18:20:31 +02:00
|
|
|
class cygthread
|
|
|
|
{
|
2003-04-10 07:27:34 +02:00
|
|
|
LONG inuse;
|
2002-08-01 18:20:31 +02:00
|
|
|
DWORD id;
|
|
|
|
HANDLE h;
|
|
|
|
HANDLE ev;
|
2002-10-13 20:16:33 +02:00
|
|
|
HANDLE thread_sync;
|
2002-12-11 05:00:04 +01:00
|
|
|
void *stack_ptr;
|
2002-08-01 18:20:31 +02:00
|
|
|
const char *__name;
|
|
|
|
LPTHREAD_START_ROUTINE func;
|
|
|
|
VOID *arg;
|
2002-08-29 05:33:50 +02:00
|
|
|
bool is_freerange;
|
2002-10-22 22:16:31 +02:00
|
|
|
static bool exiting;
|
2002-08-01 18:20:31 +02:00
|
|
|
public:
|
2004-12-05 22:29:37 +01:00
|
|
|
void terminate_thread ();
|
2003-12-14 08:09:22 +01:00
|
|
|
static DWORD WINAPI stub (VOID *);
|
2004-01-14 16:45:37 +01:00
|
|
|
static DWORD WINAPI simplestub (VOID *);
|
2003-08-28 04:04:16 +02:00
|
|
|
static DWORD main_thread_id;
|
2002-08-01 18:20:31 +02:00
|
|
|
static const char * name (DWORD = 0);
|
2004-11-26 05:15:10 +01:00
|
|
|
void release () { __name = NULL; inuse = false; }
|
2002-08-01 18:20:31 +02:00
|
|
|
cygthread (LPTHREAD_START_ROUTINE, LPVOID, const char *);
|
|
|
|
cygthread () {};
|
|
|
|
static void init ();
|
2002-12-14 05:01:32 +01:00
|
|
|
bool detach (HANDLE = NULL);
|
2002-08-01 18:20:31 +02:00
|
|
|
operator HANDLE ();
|
|
|
|
void * operator new (size_t);
|
2002-10-22 22:16:31 +02:00
|
|
|
static cygthread *freerange ();
|
2002-08-02 04:10:24 +02:00
|
|
|
void exit_thread ();
|
2002-09-29 04:19:35 +02:00
|
|
|
static void terminate ();
|
2002-10-09 07:55:40 +02:00
|
|
|
bool SetThreadPriority (int nPriority) {return ::SetThreadPriority (h, nPriority);}
|
|
|
|
void zap_h ()
|
|
|
|
{
|
|
|
|
(void) CloseHandle (h);
|
|
|
|
h = NULL;
|
|
|
|
}
|
2002-08-01 18:20:31 +02:00
|
|
|
};
|
2002-08-06 07:08:55 +02:00
|
|
|
|
|
|
|
#define cygself NULL
|
2004-11-26 05:15:10 +01:00
|
|
|
#endif /*_CYGTHREAD_H*/
|