This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
[PATCH] Move per_thread::set() def from fork.cc to perthread.h
- To: <cygwin-patches at sourceware dot cygnus dot com>
- Subject: [PATCH] Move per_thread::set() def from fork.cc to perthread.h
- From: "Gary R. Van Sickle" <g dot r dot vansickle at worldnet dot att dot net>
- Date: Sun, 14 Oct 2001 08:22:49 -0500
Sun Oct 14 08:10:12 2001 Gary R. Van Sickle
* perthread.h (per_thread::set): Move per_thread::set()
definition from fork.cc to perthread.h, where the rest of
per_thread resides.
(_PERTHREAD_H_): Add multiple-inclusion protection.
* fork.cc (per_thread::set): Move per_thread::set()
definition from fork.cc to perthread.h, where the rest of
per_thread resides.
(fork_parent): Correct the "unable to allocate
forker_finished event" error message. It named the wrong
event before.
Index: winsup/CYGWIN/perthread.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/perthread.h,v
retrieving revision 1.7
diff -p -u -b -r1.7 perthread.h
--- perthread.h 2001/09/15 00:47:44 1.7
+++ perthread.h 2001/10/14 13:01:57
@@ -1,3 +1,6 @@
+#ifndef _PERTHREAD_H_
+#define _PERTHREAD_H_
+
/* perthread.h: Header file for cygwin synchronization primitives.
Copyright 2000, 2001 Red Hat, Inc.
@@ -48,7 +51,15 @@ public:
virtual void *get () {return TlsGetValue (get_tls ());}
virtual size_t size () {return 0;}
- virtual void set (void *s = NULL);
+ virtual void set (void *s = NULL)
+ {
+ if (s == PER_THREAD_FORK_CLEAR)
+ {
+ tls = TlsAlloc ();
+ s = NULL;
+ }
+ TlsSetValue (get_tls (), s);
+ }
virtual void set (int n) {TlsSetValue (get_tls (), (void *)n);}
virtual void *create ()
{
@@ -116,3 +127,5 @@ extern per_thread_waitq waitq_storage;
extern per_thread_signal_dispatch signal_dispatch_storage;
extern per_thread *threadstuff[];
+
+#endif /* _PERTHREAD_H_ */
Index: winsup/CYGWIN/fork.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fork.cc,v
retrieving revision 1.73
diff -p -u -b -r1.73 fork.cc
--- fork.cc 2001/10/10 02:32:12 1.73
+++ fork.cc 2001/10/14 13:02:04
@@ -45,16 +45,6 @@ static pid_t fork_pids[100];
#define dll_bss_start &_bss_start__
#define dll_bss_end &_bss_end__
-void
-per_thread::set (void *s)
-{
- if (s == PER_THREAD_FORK_CLEAR)
- {
- tls = TlsAlloc ();
- s = NULL;
- }
- TlsSetValue (get_tls (), s);
-}
static void
stack_base (child_info_fork &ch)
@@ -422,7 +412,7 @@ fork_parent (HANDLE& hParent, dll *&firs
{
CloseHandle (hParent);
CloseHandle (subproc_ready);
- system_printf ("unable to allocate subproc_ready event, %E");
+ system_printf ("unable to allocate forker_finished event, %E");
return -1;
}