Commit Graph

12 Commits

Author SHA1 Message Date
Robert Collins d288c1c78c 2002-06-25 Thomas Pfaff <tpfaff@gmx.net>
* include/pthread.h (PTHREAD_CANCELED): Defined a reasonable
        value.
	* pthread.cc (pthread_exit): Call method instead of function.
	(pthread_setcancelstate): Ditto.
	(pthread_setcanceltype): Ditto.
	(pthread_testcancel): Ditto.
	* thread.h (pthread::cancel_event): New member.
        (__pthread_cancel_self): New prototype.
	(pthread::exit): New Method.
	(pthread::cancel): Ditto.
	(pthread::testcancel): Ditto.
	(pthread::cancel_self): Ditto.
	(pthread::static_cancel_self): Ditto.
	(pthread::setcancelstate): Ditto.
	(pthread::setcanceltype): Ditto.
	(__pthread_cancel): Give c++ linkage.
	(__pthread_exit): Remove.
	(__pthread_setcancelstate): Ditto.
	(__pthread_setcanceltype): Ditto.
	(__pthread_testcancel): Ditto.
	 * thread.cc (pthread::pthread): Inititialize cancel_event.
	(pthread::~pthread): Close cancel_event if needed.
	(pthread::create): Create cancel_event.
	(pthread::exit): New method. Replacement for __pthread_exit.
	(pthread::cancel): New method.
	(pthread::testcancel): Ditto.
	(pthread::static_cancel_self); New static method.
	(pthread::setcancelstate): New method. Replacement for
	__pthread_setcancelstate.
	(pthread::setcanceltype): New method. Replacement for
	__pthread_setcanceltype.
	(pthread::pop_cleanup_handler): Added lock for async cancel safe
	cancellation.
	(pthread::thread_init_wrapper): Change __pthread_exit to
	thread->exit().
	(__pthread_cancel): Call method thread->cancel().
	(__pthread_exit): Remove.
	(__pthread_setcancelstate): Ditto.
	(__pthread_setcanceltype): Ditto.
	(__pthread_testcancel): Ditto.
2002-07-04 14:17:30 +00:00
Robert Collins 007276b30e 2002-06-10 Robert Collins <rbtcollins@hotmail.com>
* cygwin.din: Add _pthread_cleanup_push and _pthread_cleanup_pop.
        * pthread.cc: Change __pthread_self to pthread::self() thruoghout.
        (_pthread_cleanup_push): New function.
        (_pthread_cleanup_pop): Ditto.
        * thread.cc: Thanks to Thomas Pfaff for the pthread cleanup_push,_pop
        patch, this work is derived from that.
        Change __pthread_self to pthread::self() thruoghout.
        (__pthread_self): Rename to pthread::self.
        (pthread::self): New method.
        (pthread::pthread): Initialize new member.
        (pthread::push_cleanup_handler): New method.
        (pthread::pop_cleanup_handler): New method.
        (pthread::pop_all_cleanup_handlers): New method.
        (__pthread_exit): Pop all cleanup handlers.
        * thread.h (pthread::push_cleanup_handler): Declare.
        (pthread::pop_cleanup_handler): Ditto.
        (pthread::pop_all_cleanup_handlers): Ditto.
        (pthread::self): New static method.
        (__pthread_exit): Give C++ linkage.
        (__pthread_join): Ditto.
        (__pthread_detach): Ditto.
        (__pthread_self): Remove.

2002-04-24  Thomas Pfaff  <tpfaff@gmx.net>

        * include/pthread.h (__pthread_cleanup_handler): New structure
        (pthread_cleanup_push): Rewritten .
        (pthread_cleanup_pop): Ditto.
        (_pthread_cleanup_push): New prototype.
        (_pthread_cleanup_pop) Ditto.

2002-04-24  Thomas Pfaff  <tpfaff@gmx.net>

        * thread.cc (thread_init_wrapper): Check if thread is already joined.
        (__pthread_join): Set joiner first.
        (__pthread_detach): Ditto.
2002-06-10 01:10:45 +00:00
Robert Collins 86336f4fea Sat Sep 29 18:26:00 2001 Robert Collins <rbtcollins@hotmail.com>
* pthread.cc (pthread_cond_timedwait): Deleted - exported from thread.cc.
        (pthread_cond_wait): Deleted - exported from thread.cc.
        * thread.cc (pthread_cond::BroadCast): Update to use the new syntax for
        verifyable_object_isvalid ().
        (pthread_cond::Signal): Ditto. Also attempt to fix the lost signal race
        with pthread_cond::TimedWait().
        (check_valid_pointer): Change definiton to void const *.
        (verifyable_object_isvalid): Add new parameter to allow identification of
        static initializers, and return a enum rather than magic numbers.
        (__pthread_create): Ditto.
        (__pthread_cleanup): Ditto.
        (__pthread_attr_init): Ditto.
        (__pthread_attr_getinheritsched): Ditto.
        (__pthread_attr_getschedparam): Ditto.
        (__pthread_attr_getschedpolicy): Ditto.
        (__pthread_attr_getscope): Ditto.
        (__pthread_attr_setdetachstate): Ditto.
        (__pthread_attr_getdetachstate): Ditto.
        (__pthread_attr_setinheritsched): Ditto.
        (__pthread_attr_setschedparam): Ditto.
        (__pthread_attr_setschedpolicy): Ditto.
        (__pthread_attr_setscope): Ditto.
        (__pthread_attr_setstacksize): Ditto.
        (__pthread_attr_getstacksize): Ditto.
        (__pthread_attr_destroy): Ditto.
        (__pthread_join): Ditto.
        (__pthread_detach): Ditto.
        (__pthread_suspend): Ditto.
        (__pthread_continue): Ditto.
        (__pthread_getschedparam): Ditto.
        (__pthread_getsequence_np): Ditto.
        (__pthread_key_create): Ditto.
        (__pthread_key_delete): Ditto.
        (__pthread_setschedparam): Ditto.
        (__pthread_setspecific): Ditto.
        (__pthread_getspecific): Ditto.
        (__pthread_cond_destroy): Ditto.
        (__pthread_cond_init): Ditto.
        (__pthread_cond_broadcast): Ditto.
        (__pthread_cond_signal): Ditto.
        (__pthread_condattr_init): Ditto.
        (__pthread_condattr_getpshared): Ditto.
        (__pthread_condattr_setpshared): Ditto.
        (__pthread_condattr_destroy): Ditto.
        (__pthread_kill): Ditto.
        (__pthread_mutex_init): Ditto.
        (__pthread_mutex_getprioceiling): Ditto.
        (__pthread_mutex_lock): Ditto.
        (__pthread_mutex_trylock): Ditto.
        (__pthread_mutex_unlock): Ditto.
        (__pthread_mutex_destroy): Ditto.
        (__pthread_mutex_setprioceiling): Ditto.
        (__pthread_mutexattr_getprotocol): Ditto.
        (__pthread_mutexattr_getpshared): Ditto.
        (__pthread_mutexattr_gettype): Ditto.
        (__pthread_mutexattr_init): Ditto.
        (__pthread_mutexattr_destroy): Ditto.
        (__pthread_mutexattr_setprotocol): Ditto.
        (__pthread_mutexattr_setprioceiling): Ditto.
        (__pthread_mutexattr_getprioceiling): Ditto.
        (__pthread_mutexattr_setpshared): Ditto.
        (__pthread_mutexattr_settype): Ditto.
        (__sem_init): Ditto.
        (__sem_destroy): Ditto.
        (__sem_wait): Ditto.
        (__sem_trywait): Ditto.
        (__sem_post): Ditto.
        (__pthread_cond_dowait): New function, contains core logic from
        __pthread_cond_wait and __pthread_cond_timedwait. Decrement (*cond)->waiting
        before reentering the cond access mutex to allow detection of lost signals.
        (__pthread_cond_timedwait): Rename to pthread_cond_timedwait, and call
        __pthread_cond_dowait after calculating the wait length.
        (__pthread_cond_wait): Rename to pthread_cond_wait, and call
        __pthread_cond_dowait.
        * thread.h: New enum for use with verifyable_object_isvalid.
        Remove the extern exporting of __pthread_cond_timedwait and __pthread_cond_wait.
2001-09-29 09:01:01 +00:00
Christopher Faylor 39b6859a28 * fork.cc (fork_child): Call the __pthread_atforkchild function.
(fork_parent): Call the __pthread_atforkparent function.
* cygwin.din: Export pthread_atfork.
* thread.h (callback): New class.
(MTinterface): Use it.
* thread.cc (__pthread_atforkprepare): New function.
(__pthread_atforkparent): New function.
(__pthread_atforkchild): New function.
(__pthread_atfork): New function.
* pthread.cc (pthread_atfork): New function.
2001-04-13 15:28:20 +00:00
Robert Collins 5c83f260b8 * configure.in: Remove PTH_ALLOW.
* cygwin.din: Remove @PTH_ALLOW@ prefixes to pthread functions.
	Add new pthread exports.
	* pthread.cc: New wrapper functions for the above new exports.
	* sched.cc (valid_sched_parameters): New function.
	(sched_setparam): Use it.
	(sched_set_thread_priority): New function. Used by pthread_sched*.
	* thread.cc (pthread_key_destructor::InsertAfter): New function.
	(pthread_key_destructor::UnlinkNext): New function.
	(pthread_key_destructor::Next): New function.
	(pthread_key_destructor_list::Insert): New function.
	(pthread_key_destructor_list::Remove): New function.
	(pthread_key_destructor_list::Pop): New function.
	(pthread_key_destructor::pthread_key_destructor): New function.
	(pthread_key_destructor_list::IterateNull): New function.
	(MTinterface::Init): Initialise new member.
	(pthread::pthread): Initialise new members.
	(pthread::create): Copy new attributes. Set the new thread priority.
	(pthread_attr::pthread_attr): Initialise new members.
	(pthread_key::pthread_key): Setup destructor function.
	(pthread_key::~pthread_key): Remove destructor function.
	(pthread_mutexattr::pthread_mutexattr): New function.
	(pthread_mutexattr::~pthread_mutexattr): New function.
	(__pthread_once): New function.
	(__pthread_cleanup): New function.
	(__pthread_cancel): New function.
	(__pthread_setcancelstate): New function.
	(__pthread_setcanceltype): New function.
	(__pthread_testcancel): New function.
	(__pthread_attr_getinheritsched): New function.
	(__pthread_attr_getschedparam): New function.
	(__pthread_attr_getschedpolicy): New function.
	(__pthread_attr_getscope): New function.
	(__pthread_attr_setinheritsched): New function.
	(__pthread_attr_setschedparam): New function.
	(__pthread_attr_setschedpolicy): New function.
	(__pthread_attr_setscope): New function.
	(__pthread_exit): Call any key destructors on thread exit.
	(__pthread_join): Use the embedded attr values.
	(__pthread_detach): Use the embedded attr values.
	(__pthread_getconcurrency): New function.
	(__pthread_getschedparam): New function.
	(__pthread_key_create): Pass the destructor on object creation.
	(__pthread_key_delete): Correct incorrect prototype.
	(__pthread_setconcurrency): New function.
	(__pthread_setschedparam): New function.
	(__pthread_cond_timedwait): Support static mutex initialisers.
	(__pthread_cond_wait): Ditto.
	(__pthread_mutex_getprioceiling): New function.
	(__pthread_mutex_lock): Support static mutex initialisers.
	(__pthread_mutex_trylock): Ditto.
	(__pthread_mutex_unlock): Ditto.
	(__pthread_mutex_destroy): Ditto.
	(__pthread_mutex_setprioceiling): New function.
	(__pthread_mutexattr_getprotocol): New function.
	(__pthread_mutexattr_getpshared): New function.
	(__pthread_mutexattr_gettype): New function.
	(__pthread_mutexattr_init): New function.
	(__pthread_mutexattr_destroy): New function.
	(__pthread_mutexattr_setprotocol): New function.
	(__pthread_mutexattr_setprioceiling): New function.
	(__pthread_mutexattr_getprioceiling): New function.
	(__pthread_mutexattr_setpshared): New function.
	(__pthread_mutexattr_settype): New function.
	Remove stubs for non MT_SAFE compilation.
	* thread.h: Remove duplicate #defines.
	Add prototypes for new functions in thread.cc.
	(pthread_key_destructor): New class.
	(pthread_key_destructor_list): New class.
	(pthread_attr): Add new members.
	(pthread): Remove members that are duplicated in the pthread_attr class.
	(pthread_mutex_attr): Add new members.
	(pthread_once): New class.
	* include/pthread.h: Add prototypes for new functions exported from cygwin1.dll.
	Remove typedefs.
	* include/sched.h: Add prototypes for new functions in sched.cc.
	* include/cygwin/types.h: Add typedefs from pthread.h
2001-04-12 04:04:53 +00:00
Christopher Faylor aa970c616c * Makefile.in: Put -lgcc last in list of libraries, since stdc++ library needs
it.
* cygwin.din: Remove obsolete "__empty" export.
* exceptions.cc (call_signal_handler_now): Force inclusion of function even
when -finline-functions is specified.
* sigproc.h: Remove obsolete call_signal_handler declaration.
* fhandler_console.cc (cp_get_internal): New function.
(cp_convert): New function.
(con_to_str): New function.
(str_to_con): New function.
(fhandler_console::read): Replace OemToCharBuff with con_to_str.
(fhandler_console::write_normal): Replace CharToOemBuff with str_to_con.
2001-04-09 00:44:25 +00:00
Christopher Faylor 9a08b2c02e * sched.cc: New file. Implement sched*.
* include/sched.h: New file.  User land includes for sched*.
* Makefile.in: Add sched.o
* cygwin.din: Add exports for sched*.
2001-03-21 02:17:58 +00:00
Christopher Faylor 94b03f2380 Fix spacing, copyrights. 2001-03-18 21:11:25 +00:00
Christopher Faylor 5ccbf4b699 * cygwin.din: Export the new functions.
* pthread.cc (pthread_cond_*): Add wrapper functions that call __pthread_cond*
functions.
* thread.cc (__pthread_cond_*): Implement the pthread_cond* functions.
* thread.h: Add new class entries and prototypes for __pthread_cond* functions.
* include/pthread.h: user land header prototypes for pthread_cond* functions
and related defines.
2001-03-17 01:14:58 +00:00
Christopher Faylor f76325499a * path.cc (readlink): Check if buffer length is positive. Truncate output to
buffer length.  Don't terminate buffer with '\0'.
2000-09-04 17:52:42 +00:00
Christopher Faylor bccd5e0d85 * winsup.h: Eliminate inclusion of most of the cygwin .h files. Use .h files
only in sources which require them.
* Makefile.in: Generate dependencies with -MD option.
2000-08-22 05:10:20 +00:00
Christopher Faylor 1fd5e000ac import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00