Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Pfaff <tpfaff@gmx.net>2003-06-25 00:14:01 +0400
committerThomas Pfaff <tpfaff@gmx.net>2003-06-25 00:14:01 +0400
commite1e196a225a1fee14447b5ef409c5b3890f98334 (patch)
tree58657e1abe9c0a82f29fce455a0213425a1988d7 /winsup/cygwin/thread.h
parentb8f7ea5ccba184f7a3718312a186b8ea45a153ed (diff)
* thread.cc (MTinterface::fixup_after_fork): Fix thread list after fork.
(pthread::threads): Instantiate. (pthread::pthread): Initialize running and suspendend. Initialize next with NULL. Add thread to thread list if it is not the null_pthread. (pthread::~pthread): Remove thread from thread list if it is not the null_pthread. (pthread::postcreate): Set running flag. (pthread::exit): Reset running flag. (pthread::cancel): Try to cancel thread only if still running. (pthread::_fixup_after_fork): Implement. (pthread::detach): Check if thread is still running before detach. * thread.h (pthread::running): New member. (pthread::next): Ditto. (pthread::fixup_after_fork): New static method. (pthread::threads): New static method. (pthread::_fixup_after_fork): New method.
Diffstat (limited to 'winsup/cygwin/thread.h')
-rw-r--r--winsup/cygwin/thread.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h
index e89640e6b..ea1f13f44 100644
--- a/winsup/cygwin/thread.h
+++ b/winsup/cygwin/thread.h
@@ -385,11 +385,11 @@ public:
void *(*function) (void *);
void *arg;
void *return_ptr;
+ bool running;
bool suspended;
int cancelstate, canceltype;
HANDLE cancel_event;
pthread_t joiner;
- // int joinable;
/* signal handling */
struct sigaction *sigs;
@@ -442,11 +442,21 @@ public:
return t1 == t2;
}
+ /* List support calls */
+ class pthread *next;
+ static void fixup_after_fork ()
+ {
+ threads.for_each (&pthread::_fixup_after_fork);
+ }
+
private:
+ static List<pthread> threads;
DWORD thread_id;
__pthread_cleanup_handler *cleanup_stack;
pthread_mutex mutex;
+ void _fixup_after_fork ();
+
void pop_all_cleanup_handlers (void);
void precreate (pthread_attr *);
void postcreate ();