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