* 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.
This commit is contained in:
parent
5a7e00a866
commit
4db1bd4040
@ -1,3 +1,18 @@
|
|||||||
|
2010-07-28 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2010-07-23 Corinna Vinschen <corinna@vinschen.de>
|
2010-07-23 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler.cc (fhandler_base::raw_write): Remove STATUS_DISK_FULL
|
* fhandler.cc (fhandler_base::raw_write): Remove STATUS_DISK_FULL
|
||||||
|
@ -185,9 +185,8 @@ out:
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
cygthread::cygthread (LPTHREAD_START_ROUTINE start, size_t n, void *param,
|
void
|
||||||
const char *name, HANDLE notify)
|
cygthread::create ()
|
||||||
: __name (name), func (start), arglen (n), arg (param), notify_detached (notify)
|
|
||||||
{
|
{
|
||||||
thread_printf ("name %s, id %p", name, id);
|
thread_printf ("name %s, id %p", name, id);
|
||||||
HANDLE htobe;
|
HANDLE htobe;
|
||||||
@ -214,7 +213,7 @@ cygthread::cygthread (LPTHREAD_START_ROUTINE start, size_t n, void *param,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n)
|
if (arglen)
|
||||||
{
|
{
|
||||||
while (!ev)
|
while (!ev)
|
||||||
yield ();
|
yield ();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* cygthread.h
|
/* 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
|
This software is a copyrighted work licensed under the terms of the
|
||||||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||||
@ -9,6 +10,8 @@ details. */
|
|||||||
#ifndef _CYGTHREAD_H
|
#ifndef _CYGTHREAD_H
|
||||||
#define _CYGTHREAD_H
|
#define _CYGTHREAD_H
|
||||||
|
|
||||||
|
typedef void WINAPI (*LPVOID_THREAD_START_ROUTINE) (void *) __attribute__((noreturn)); // Input queue thread
|
||||||
|
|
||||||
class cygthread
|
class cygthread
|
||||||
{
|
{
|
||||||
LONG inuse;
|
LONG inuse;
|
||||||
@ -28,6 +31,7 @@ class cygthread
|
|||||||
bool is_freerange;
|
bool is_freerange;
|
||||||
static bool exiting;
|
static bool exiting;
|
||||||
HANDLE notify_detached;
|
HANDLE notify_detached;
|
||||||
|
void create () __attribute__ ((regparm(1)));
|
||||||
public:
|
public:
|
||||||
bool terminate_thread ();
|
bool terminate_thread ();
|
||||||
static DWORD WINAPI stub (VOID *);
|
static DWORD WINAPI stub (VOID *);
|
||||||
@ -37,7 +41,20 @@ class cygthread
|
|||||||
void callfunc (bool) __attribute__ ((noinline, regparm (2)));
|
void callfunc (bool) __attribute__ ((noinline, regparm (2)));
|
||||||
void auto_release () {func = NULL;}
|
void auto_release () {func = NULL;}
|
||||||
void release (bool);
|
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 () {};
|
cygthread () {};
|
||||||
static void init ();
|
static void init ();
|
||||||
bool detach (HANDLE = NULL);
|
bool detach (HANDLE = NULL);
|
||||||
|
@ -46,9 +46,9 @@ struct pipe_reply {
|
|||||||
|
|
||||||
fhandler_tty_master NO_COPY *tty_master;
|
fhandler_tty_master NO_COPY *tty_master;
|
||||||
|
|
||||||
static DWORD WINAPI process_input (void *); // Input queue thread
|
static void WINAPI process_input (void *) __attribute__((noreturn)); // Input queue thread
|
||||||
static DWORD WINAPI process_output (void *); // Output queue thread
|
static void WINAPI process_output (void *) __attribute__((noreturn)); // Output queue thread
|
||||||
static DWORD WINAPI process_ioctl (void *); // Ioctl requests thread
|
static void WINAPI process_ioctl (void *) __attribute__((noreturn)); // Ioctl requests thread
|
||||||
|
|
||||||
fhandler_tty_master::fhandler_tty_master ()
|
fhandler_tty_master::fhandler_tty_master ()
|
||||||
: fhandler_pty_master (), console (NULL)
|
: fhandler_pty_master (), console (NULL)
|
||||||
@ -89,18 +89,9 @@ fhandler_tty_master::init ()
|
|||||||
|
|
||||||
set_close_on_exec (true);
|
set_close_on_exec (true);
|
||||||
|
|
||||||
cygthread *h;
|
new cygthread (process_input, 0, cygself, "ttyin");
|
||||||
h = new cygthread (process_input, 0, cygself, "ttyin");
|
new cygthread (process_ioctl, 0, cygself, "ttyioctl");
|
||||||
h->SetThreadPriority (THREAD_PRIORITY_HIGHEST);
|
new cygthread (process_output, 0, cygself, "ttyout");
|
||||||
h->zap_h ();
|
|
||||||
|
|
||||||
h = new cygthread (process_ioctl, 0, cygself, "ttyioctl");
|
|
||||||
h->SetThreadPriority (THREAD_PRIORITY_HIGHEST);
|
|
||||||
h->zap_h ();
|
|
||||||
|
|
||||||
h = new cygthread (process_output, 0, cygself, "ttyout");
|
|
||||||
h->SetThreadPriority (THREAD_PRIORITY_HIGHEST);
|
|
||||||
h->zap_h ();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -225,7 +216,7 @@ fhandler_pty_master::accept_input ()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD WINAPI
|
static void WINAPI
|
||||||
process_input (void *)
|
process_input (void *)
|
||||||
{
|
{
|
||||||
char rawbuf[INP_BUFFER_SIZE];
|
char rawbuf[INP_BUFFER_SIZE];
|
||||||
@ -414,7 +405,7 @@ out:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD WINAPI
|
static void WINAPI
|
||||||
process_output (void *)
|
process_output (void *)
|
||||||
{
|
{
|
||||||
char buf[OUT_BUFFER_SIZE * 2];
|
char buf[OUT_BUFFER_SIZE * 2];
|
||||||
@ -436,7 +427,7 @@ process_output (void *)
|
|||||||
|
|
||||||
/* Process tty ioctl requests */
|
/* Process tty ioctl requests */
|
||||||
|
|
||||||
static DWORD WINAPI
|
static void WINAPI
|
||||||
process_ioctl (void *)
|
process_ioctl (void *)
|
||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user