summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/cygthread.h
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2010-07-30 18:04:22 +0000
committerChristopher Faylor <me@cgf.cx>2010-07-30 18:04:22 +0000
commit4db1bd4040e1f12df5a4432ee228af9f5d2a084a (patch)
tree10e36b1da57d77e705b4fcbf0ff77bc7512150c9 /winsup/cygwin/cygthread.h
parent5a7e00a86655de00cf65577e5d2e357c54e4ed37 (diff)
downloadcygnal-4db1bd4040e1f12df5a4432ee228af9f5d2a084a.tar.gz
cygnal-4db1bd4040e1f12df5a4432ee228af9f5d2a084a.tar.bz2
cygnal-4db1bd4040e1f12df5a4432ee228af9f5d2a084a.zip
* cygthread.h (LPVOID_THREAD_START_ROUTINE): Define.
(cygthread::create): Rename from cygthread::cygthread. (cygthread::cygthread): Define new constructor which accepts LPVOID_THREAD_START_ROUTINE as the first argument. Call cygthread::create. * cygthread.cc (cygthread::create): Rename from cygthread::cygthread. Use 'arglen' rather than 'n' since 'n' is no longer supplied. * fhandler_tty.cc (process_input): Define as void/noreturn. (process_output): Ditto. (process_ioctl): Ditto. (fhandler_tty_master::init): Don't "zap_h" cygthreads which are noreturn. It's now implied.
Diffstat (limited to 'winsup/cygwin/cygthread.h')
-rw-r--r--winsup/cygwin/cygthread.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/winsup/cygwin/cygthread.h b/winsup/cygwin/cygthread.h
index da7172e63..593cfdd0a 100644
--- a/winsup/cygwin/cygthread.h
+++ b/winsup/cygwin/cygthread.h
@@ -1,6 +1,7 @@
/* cygthread.h
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2010
+ Red Hat, Inc.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
@@ -9,6 +10,8 @@ details. */
#ifndef _CYGTHREAD_H
#define _CYGTHREAD_H
+typedef void WINAPI (*LPVOID_THREAD_START_ROUTINE) (void *) __attribute__((noreturn)); // Input queue thread
+
class cygthread
{
LONG inuse;
@@ -28,6 +31,7 @@ class cygthread
bool is_freerange;
static bool exiting;
HANDLE notify_detached;
+ void create () __attribute__ ((regparm(1)));
public:
bool terminate_thread ();
static DWORD WINAPI stub (VOID *);
@@ -37,7 +41,20 @@ class cygthread
void callfunc (bool) __attribute__ ((noinline, regparm (2)));
void auto_release () {func = NULL;}
void release (bool);
- cygthread (LPTHREAD_START_ROUTINE, unsigned, LPVOID, const char *, HANDLE = NULL);
+ cygthread (LPTHREAD_START_ROUTINE start, unsigned n, LPVOID param, const char *name, HANDLE notify = NULL)
+ : __name (name), func (start), arglen (n), arg (param), notify_detached (notify)
+ {
+ create ();
+ }
+ cygthread (LPVOID_THREAD_START_ROUTINE start, unsigned n, LPVOID param, const char *name, HANDLE notify = NULL)
+ : __name (name), func ((LPTHREAD_START_ROUTINE) start), arglen (n),
+ arg (param), notify_detached (notify)
+ {
+ create ();
+ /* This is a neverending/high-priority thread */
+ ::SetThreadPriority (h, THREAD_PRIORITY_HIGHEST);
+ zap_h ();
+ }
cygthread () {};
static void init ();
bool detach (HANDLE = NULL);