summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/cygthread.cc
Commit message (Collapse)AuthorAgeFilesLines
* Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout optioncygwin-2_5_2-releaseCorinna Vinschen2016-06-231-3/+0
| | | | | | | | | | | | | | Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause. Everything else stays under GPLv3+. New Linking Exception exempts resulting executables from LGPLv3 section 4. Add CONTRIBUTORS file to keep track of licensing. Remove 'Copyright Red Hat Inc' comments. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix race condition when waiting for a signalCorinna Vinschen2015-11-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | * cygtls.h (_cygtls::wait_signal_arrived): Renamed from set_signal_arrived. (_cygtls::set_signal_arrived): New function signalling signal_arrived. (_cygtls::reset_signal_arrived): Don't reset will_wait_for_signal. (_cygtls::unwait_signal_arrived): New function only resetting will_wait_for_signal. (class wait_signal_arrived): Rename from set_signal_arrived. Accommodate name change throughout Cygwin. (wait_signal_arrived::~wait_signal_arrived): Call _cygtls::unwait_signal_arrived. Add comment. * cygserver_ipc.h (ipc_set_proc_info): Fetch signal_arrived handle via call to _cygtls::get_signal_arrived. * exceptions.cc (_cygtls::interrupt_setup): Signal signal_arrived via call to _cygtls::set_signal_arrived. (_cygtls::handle_SIGCONT): Ditto. * fhandler_socket.cc (fhandler_socket::wait_for_events): Generate WSAEVENT array prior to entering wait loop. Add cancel event object if available. Remove calls to pthread_testcancel and just call pthread::static_cancel_self if the cancel event object is signalled. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* * Merge in cygwin-64bit-branch.Corinna Vinschen2013-04-231-10/+10
|
* * cygthread.cc (cygthread::terminate_thread): Only try to freeCorinna Vinschen2013-03-291-10/+13
| | | | | | thread stack on systems not freeing it by themselves. * wincap.h (wincaps::terminate_thread_frees_stack): New element. * wincap.cc: Implement above element throughout.
* Throughout, update copyrights to reflect dates which correspond to main-branchChristopher Faylor2013-01-211-2/+2
| | | | checkins. Regularize copyright format.
* * cygthread.cc (cygthread::stub): Remove old, unnecessary, FIXMEd code.Christopher Faylor2012-09-141-6/+0
| | | | * spawn.cc (child_info_spawn::worker): Avoid calling close_all_files() twice.
* Change "set_thread_waiting" to "set_signal_arrived" throughout.Christopher Faylor2012-07-231-1/+1
|
* * DevNotes: Add entry cgf-000013.Christopher Faylor2012-07-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cygserver_ipc.h (ipc_set_proc_info): Use _cygtls::ipc_set_proc_info to set per-thread signal arrived value. * cygthread.cc (cygthread::detach): Use per-thread signal_arrived via set_thread_waiting. * fork.cc (_cygtls::fixup_after_fork): Clear signal_arrived. (_cygtls::remove): Close any signal_arrived handle when thread exists. (_cygtls::find_tls): Remove unneeded function. * cygtls.h: Update copyright. (class _cygtls): Reorganize to help avoid rebuilding newlib when structure changes. (_cygtls::event): Delete. (_cygtls::threadkill): Ditto. (_cygtls::signal_waiting): Declare new bool. (_cygtls::find_tls): Delete declaration. (_cygtls::set_threadkill): Ditto. (_cygtls::reset_threadkill): Ditto. (_cygtls::set_signal_arrived): Declare new function. (class set_thread_waiting): Declare new class. * cygwait.cc (cw_nowait_storage): Define. (cygwait): Set per-thread signal_arrived via set_thread_waiting. Don't special-case _main_tls. * cygwait.h (cw_nowait): Define. (cw_infinite): Ditto. (cygwait): Redefine pathological wait-only case. * dcrt0.cc (dll_crt0_0): Remove call to now-defunct events_init(). (dll_crt0_1): Remove call to now-defunct create_signal_arrived(). * exceptions.cc: Reflect set_signal_mask() argument reordering throughout. Remove signal mask synchronization throughout. (events_init): Delete definition. (mask_sync): Delete now-unneeded mask synchronization. (set_signal_mask): Reverse order of arguments to "standard" to, from layout. Rename "newmask" argument to "setmask". Remove debugging. (sig_handle_tty_stop): Use cancelable_wait rather than WFMO. (_cygtls::interrupt_setup): Don't treat "threadkill" events specially. Conditionally set signal_arrived depending on whether the thread has created it or not. (sigpacket::process): Reorganize to reflect thread-specific sending of signals which is more in line with the way it was actually supposed to work. * fhandler_socket.cc (get_inet_addr): Use cancelable_wait rather than IsEventSignalled to avoid potential race. (fhandler_socket::wait_for_events): Set signal_arrived event using set_thread_waiting(). (fhandler_socket::close): Use cygwait for the case of just waiting 10 ms for a signal. * fhandler_tape.cc (fhandler_dev_tape::_lock): Use cancelable_wait rather than WFMO. Redo switch/case tests accordingly. * fhandler_termios.cc (fhandler_termios::bg_check): Use cygwait for case of just waiting 0 ms for a potential signal. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Use cancelable_wait rather than WFSO. * fhandler_windows.cc (fhandler_windows::read): Set per-thread signal_arrived via set_thread_waiting(). * flock.cc (lf_setlock): Ditto. * select.cc (pselect): Ditto. Set per-thread signal_arrived using set_thread_waiting(). * gendef: Don't special case handling of _cygtls::sig for threads. * gentls_offsets: Use #pragma once in tlsoffsets.h. * ntdll.h: Use #pragma once. * poll.cc: Reflect set_signal_mask() argument reordering. * posix_ipc.cc (ipc_mutex_lock): Use cancelable_wait rather than WFMO. (ipc_cond_timedwait): Set perl-thread signal arrived using set_thread_waiting(). * security.h: Use #pragma once. * signal.cc (abort): Reflect set_signal_mask() argument reordering. (clock_nanosleep): Ditto. Change call to cancelable_wait to properly specify handling of cancel and interrupt. (sigwaitinfo): Remove handling of per-thread event in favor of per-thread signal_arrived. Use cancelable_wait rather than WFSO. * sigproc.cc (signal_arrived): Delete definition. (create_signal_arrived): Ditto. * sigproc.h (signal_arrived): Delete declaration. (set_signal_mask): Avoid defining as a "C" function. Don't conditionally declare. (create_signal_arrived): Delete declaration. * syscalls.cc (rename): Use cygwait() rather than WFSO. * thread.h (fast_mutex::lock): Use cw_infinite rather than LARGE_NULL. * wait.cc (wait4): Ditto. * thread.cc (pthread_mutex::lock): Ditto. (pthread::join): Ditto. (semaphore::_wait): Ditto. (pthread_kill): Remove set_threadkill() accommodation. * tlsoffsets.h: Regenerate.
* Revert errneous checkin.Christopher Faylor2012-06-191-3/+20
| | | | Check in actual change associated with ChangeLog.
* * cygwait.cc (cancelable_wait): Mimic old cygwait behavior more closely wrtChristopher Faylor2012-06-191-20/+3
| | | | | | | | handling of call_signal_handler. * cygwait.h (WAIT_CANCELED): Move here and redefine. (WAIT_SIGNALED): Ditto. * thread.h (WAIT_CANCELED): Delete. (WAIT_SIGNALED): Ditto.
* Clean up whitespace.Christopher Faylor2011-12-171-1/+0
|
* missed this in previous checkinChristopher Faylor2011-11-241-2/+5
|
* * tty.cc (grantpt): Check for valid fd.Christopher Faylor2011-09-211-1/+1
| | | | (unlockpt): Ditto.
* * cygthread.cc (cygthread::simplestub): Notify that the thread has detachedChristopher Faylor2011-08-251-0/+4
| | | | also in freerange thread case.
* * cygthread.cc (cygthread::async_create): Define new function.Christopher Faylor2011-07-301-0/+11
| | | | | | | | | | | * cygthread.h (cygthread::create): Use correct regparm. (cygthread::standalone): Delete from class and from all constructors. (cygthread::cygthread): Use three only arguments for detached threads, and start the thread via QueueUserAPC/async_create. * dcrt0.cc (dll_crt0_0): Remove handling for wincap.has_buggy_thread_startup. (dll_crt0_1): Ditto. * wincap.cc: Ditto throughout. * wincap.h: Ditto.
* * ntdll.h (IsEventSignalled): New inline function.Corinna Vinschen2011-04-291-2/+3
| | | | | | | | | | | * cygthread.cc (cygthread::terminate_thread): Use IsEventSignalled in place of WaitForSingleObject on event with 0 timeout. * fhandler.cc (fhandler_base_overlapped::has_ongoing_io): Ditto. * fhandler_fifo.cc (fhandler_fifo::open_nonserver): Ditto. (fhandler_fifo::wait): Ditto. * fhandler_termios.cc (fhandler_termios::bg_check): Ditto. * select.cc (verify_tty_slave): Ditto. * thread.cc (pthread::testcancel): Ditto.
* * cygthread.cc (cygthread::create): Fix incorrect use of name rather thanChristopher Faylor2010-09-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __name. * cygthread.h (cygthread::cygthread): Create versions which eliminate 'n' parameter. * dcrt0.cc (dll_crt0_1): Remove check for threadfunc_ix. Remove obsolete comments. Set process_state to active here. * fhandler_netdrive.cc (create_thread_and_wait): Use shortened cygthread constructor. * timer.cc (timer_tracker::settime): Ditto. * window.cc (HWND): Ditto. * fhandler_tty.cc: Use shortened cygthread constructor, where appropriate, throughout. * select.cc: Ditto. * fork.cc (frok::child): Remove wait_for_sigthread. (fork): Reformat if for slightly better clarity. * init.cc (dll_finished_loading): New variable. (dll_entry): Use dll_finished_loading to determine when we should call merge_threadfunc. * sigproc.cc (no_signals_available): Simplify by using my_readsig. (wait_sig_inited): Delete. (wait_sig): Define as void function. (pending_signals): Accommodate change to wait_sig definition. (wait_for_sigthread): Delete definition. (sigproc_init): Initialize signal pipe here, before wait_sig thread is created. Use void form of cygthread creation. (init_sig_pipe): Delete. (wait_sig): Return void rather than DWORD. Assume previous initialization of signal pipe. Set my_sendsig to NULL when exiting. * sigproc.h (wait_for_sigthread): Delete declaration.
* * cygthread.cc: Update copyright.Christopher Faylor2010-08-201-2/+2
|
* * cygthread.h (LPVOID_THREAD_START_ROUTINE): Define.Christopher Faylor2010-07-301-4/+3
| | | | | | | | | | | | | (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.
* Throughout change all calls of low_priority_sleep (0) to yield ().Christopher Faylor2010-03-121-5/+5
| | | | | | | | | | * miscfuncs.cc (yield): Rename from low_priority_sleep. Remove all of the logic which called Sleep() and just use SwitchToThread. * miscfuncs.h (yield): Rename from low_priority_sleep. (SLEEP_0_STAY_LOW): Delete unused define. * shared.cc (memory_init): Move heap_init() call directly after shared memory initialization to more closely mimic long-standing program flow. * tty.cc (tty_list::terminate): Replace call to low_priority_sleep with Sleep.
* Remove unneeded header files from source files throughout. Update copyrightsChristopher Faylor2009-01-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | where appropriate. * globals.cc: New file for generic global variables. * mkglobals_h: New file to generate globals.h. * mkstatic: New Script used to build a (currently non-working) static libcygwin_s.a. * Makefile.in: Add unused rule to build a non-working libcygwin_s.a. (DLL_OFILES): Add globals.o. Make all objects rely on globals.h. (globals.h): New target. Generate globals.h. * cygtls.h: Honor new CYGTLS_HANDLE define to control when the HANDLE operator is allowed in _cygtls. * dcrt0.cc: Move most globals to globals.cc. * init.cc: Ditto. * environ.cc (strip_title_path): Remove now-unneeded extern. * fhandler_serial.cc (fhandler_serial::open): Ditto. * pinfo.cc: Ditto. (commune_process): Ditto. * shared.cc: Ditto. * glob.cc: Ditto. * strace.cc: Ditto. * exceptions.cc: Define CYGTLS_HANDLE before including winsup.h. * path.cc (stat_suffixes): Move here. * security.h: Add forward class path_conv declaration. * smallprint.cc (__small_vsprintf): Make a true c++ function. (__small_sprintf): Ditto. (small_printf): Ditto. (console_printf): Ditto. (__small_vswprintf): Ditto. (__small_swprintf): Ditto. * spawn.cc (spawn_guts): Remove _stdcall decoration in favor of regparm. (hExeced): Move to globals.cc * strfuncs.cc (current_codepage): Ditto. (active_codepage): Ditto. * sync.cc (lock_process::locker): Move here from dcrt0.cc. * syscalls.cc (stat_suffixes): Move to path.cc. * tty.cc (tty::create_master): Uncapitalize fatal warning for consistency. * winsup.h: Include globals.h to declare most of the grab bag list of globals which were previously defined here. * mount.h: Move USER_* defines back to shared_info.h. * speclib: Force temporary directory cleanup.
* Remove unneeded header files from source files throughout.Christopher Faylor2008-04-071-5/+0
|
* Add miscfuncs.h to files as needed throughout.Christopher Faylor2008-04-071-0/+1
| | | | | | | | | | | | * mount.cc: New file. * path.cc: Move mount-specific stuff into mount.cc. Move common stuff into miscfuncs.cc. Remove unneeded includes. * miscfuncs.cc: Move some common path functions here. * miscfuncs.h: New file. * winsup.h: Move miscelleneous functions to miscfuncs.h. * dcrt0.cc: Remove unneeded includes. * Makefile.in (DLL_OFILES): Add mount.o. * include/cygwin/config.h: Fix a minor typo.
* * cygthread.cc (cygthread::terminate_thread): In debugging output, use name ofChristopher Faylor2006-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | thread being terminated rather than thread doing terminating. * fhandler.h (fhandler_pty_master::slave): Delete. (fhandler_pty_master::get_unit): Ditto. (fhandler_pty_master::setup): Change argument declaration to accommodate new usage. * fhandler_tty.cc (fhandler_tty_master::init): Remove obsolete slave assignment. Pass argument to setup indicating that this is a tty. (fhandler_tty_slave::open): Use dev() method rather than referencing pc.dev directly. (fhandler_pty_master::open): Don't create archetype based on ptym device number. Set device number to use DEV_TTYM_MAJOR and tty number. Pass argument to setup indicating that this is a pty. (fhandler_pty_master::setup): Change single argument to a flag indicating whether we're creating a pty and use appropriately. Calculate 't' variable here rather than in caller. * fhandler_dsp.cc (fhandler_dev_dsp::open): Use dev() method rather than referencing pc.dev directly.
* * cygwin.din: Fix some erroneous SIGFE/NOSIGFE settings.Christopher Faylor2006-03-011-5/+10
| | | | | | | * cygthread.cc (cygthread::callfunc): Revert below change. Make ev a manual reset event again. so that it will be reset by WaitFor*Object as appropriate. (cygthread::stub): Ditto. (cygthread::terminate_thread): Reset ev if it was found to have been set.
* * cygthread.cc (cygthread::callfunc): Create ev as an auto-reset event so thatChristopher Faylor2006-03-011-8/+3
| | | | | | it will be reset by WaitFor*Object as appropriate. (cygthread::stub): Ditto. (cygthread::terminate_thread): Remove forced setting of thread termination.
* * cygthread.cc (cygthread::release): Add a comment.Christopher Faylor2006-02-281-0/+1
|
* Change process_lock to lock_process throughout. Change all calls to newChristopher Faylor2005-10-171-15/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | cygthread to handle extra argument, throughout. * cygthread.h (cygthread::callproc): Declare new method. (cygthread::cygthread): Add optional length argument to allow copying arguments to executing thread. * cygthread.cc (cygthread::callproc): Define new method. (cygthread::stub): Use callfunc to invoke thread func to allow potentially allocating stack memory which will be returned. (cygthread::simplestub): Ditto. (cygthread::cygthread): Accept arglen argument. Reset ev here prior to activating thread. Wait for ev after activating thread if we're copying contents to the thread. Wait until the end before setting h, to allow thread synchronization. (cygthread::release): Don't reset ev here. Rely on that happening the next time the thread is activated. * pinfo.h (commune_process): Rename declaration from _pinfo::commune_process. * pinfo.cc (commune_process): Ditto for definition. Modify slightly to allow running as a separate cygthread. * sigproc.cc (child_info::sync): Always wait for both subproc_ready and any hProcess if we have a cygwin parent. (talktome): Change argument to be a pointer to siginfo_t. Contiguously allocate whole siginfo_t structure + any needed extra for eventual passing to commune_process thread. (wait_sig): Accommodate change in talktome argument. * pipe.cc (fhandler_pipe::fixup_after_exec): Remove debugging.
* * cygthread.cc (cygthread::operator new): Just use getenv() to look forChristopher Faylor2005-09-211-4/+3
| | | | | CYGWIN_FREERANGE_NOCHECK since the Windows environment may be truncated by being previously execed.
* * cygthread.cc (cygthread::cygthread): Add more info to fatal error.Christopher Faylor2005-09-121-1/+1
| | | | | | * fhandler_disk_file.cc (fhandler_disk_file::readdir): Temporarily remove insertion of /dev into root directory. * path.cc (path_conv::check): Ditto.
* * cygthread.cc (cygthread::simplestub): Wait for h to be filled out by mainChristopher Faylor2005-07-291-0/+3
| | | | thread before assigning it.
* Eliminate (void) cast on standalone function calls throughout.Christopher Faylor2005-07-061-7/+7
|
* * cygthread.cc (cygthread::detach): Fix debugging output.Christopher Faylor2005-06-151-1/+1
| | | | | | | * dcrt0.cc (dll_crt0_1): Create signal_arrived early -- before any filename manipulation. * sigproc.cc (sigproc_init): Don't create signal_arrived here. * fork.cc (fork_child): Ditto.
* * cygthread.cc (cygthread::detach): Improve diagnostics for what should be anChristopher Faylor2005-06-091-1/+14
| | | | impossible failure condition.
* * cygthread.cc (cygthread::detach): Make error message a little more detailed.Christopher Faylor2005-06-071-1/+1
| | | | | | | | | * fhandler.cc (fhandler_base::raw_read): Ditto for debug message. * dcrt0.cc (do_exit): Add some more synchronization tests. * fhandler_fifo.cc (fhandler_fifo::dup): Don't duplicate a nonexistent handle. Use derived return value rather than always retuning 0. * fhandler_netdrive.cc (fhandler_netdrive::exists): Wnet -> WNet. * winsup.h (exit_states): Add a couple of new exit states.
* * cygtls.h (_local_storage::unknown_thread_name): New buffer.Christopher Faylor2005-05-181-3/+2
| | | | | | | | * tlsoffsets.h: Regenerate. * cygthread.cc (cygthread::name): Use new thread-local buffer. * exceptions.cc (handle_exceptions): Avoid unnecessary initialization of static variables to zero. * fork.cc (slow_pid_reuse) Ditto.
* * cygthread.cc (cygthread::detach): Revert to just waiting for thred eventChristopher Faylor2005-03-281-1/+1
| | | | | | | | | | | | | | | | | since waiting for anything else is racy. * timer.cc (timer_tracker::hcancel): Rename from cancel. (timer_tracker::cancel): New method. (timer_tracker::th): Remove. (timer_tracker::~timer_tracker): Call cancel method. (timer_tracker::timer_tracker): Ditto. (timer_tracker::timer_tracker): Always, clear cancel, even though it is probably not strictly necessary for ttstart. (timer_thread): Accommodate cancel -> hcancel rename. (timer_tracker::settime): Ditto. (timer_tracker::gettime): Ditto. (timer_delete): Ditto. * cygwin.din: Export _ctype_. * include/ctype.h: Mark that _ctype_ is imported.
* * wininfo.h (wininfo::timer_active): Delete.Christopher Faylor2005-03-271-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (wininfo::itv): Ditto. (wininfo::start_time): Ditto. (wininfo::window_started): Ditto. (wininfo::getitimer): Ditto. (wininfo::setitimer): Ditto. (wininfo::wininfo): Ditto. (wininfo::lock): New method. (wininfo::release): Ditto. * window.cc: Use new lock/acquire wininfo methods throughout. (wininfo::wininfo): Delete (wininfo::getitimer): Ditto. (wininfo::setitimer): Ditto. (getitimer): Ditto. (setitimer): Ditto. (ualarm): Ditto. (alarm): Ditto. (wininfo::lock): Define new function. (wininfo::release): Ditto. (wininfo::process): Delete WM_TIMER handling. * timer.cc (struct timetracker): Delete it, flags. Add it_interval, interval_us, sleepto_us, running, init_muto(), syncthread, and gettime(). (ttstart): Make NO_COPY. (lock_timer_tracker): New class. (timer_tracker::timer_tracker): Distinguish ttstart case. (timer_tracker::~timer_tracker): New destructor. Clean out events, and reset magic. (timer_tracker::init_muto): New method. (to_us): Round up as per POSIX. (timer_thread): Reorganize to match timer_tracker::settime and timer_tracker::gettime. Call sig_send without wait. Call auto_release. (timer_tracker::settime): Reorganize logic to avoid race. Call gettime to recover old value. (timer_tracker::gettime): New method. (timer_create): Properly set errno on invalid timerid. Use new lock_timer_tracker method. (timer_delete): Ditto. Simplify code slightly. (timer_gettime): New function. (fixup_timers_after_fork): Reinit ttstart. (getitimer): New implementation. (setitimer): Ditto. (ualarm): Ditto. (alarm): Ditto. * cygwin.din: Export timer_gettime. * winsup.h: Remove has has_visible_window_station declaration. * Makefile.in (DLL_OFILES): Add lsearch.o. * cygthread.h (cygthread::notify_detached): New element. (cygthread::cygthread): Take optional fourth argument signifying event to signal on thread completion. * cygthread.cc (cygthread::stub): Signal notify_detached event, if it exists. (cygthread::cygthread): Initialize notify_detached from fourth argument. (cygthread::detach): Wait for notify_detached field is present. * lsearch.cc: New file. * search.h: Ditto. * include/cygwin/version.h: Bump API minor number to 126. * cygwin.din: Export lsearch, lfind.
* * cygthread.cc (cygthread::detach): Use a slightly higher priority when waitingChristopher Faylor2005-03-031-1/+1
| | | | for thread signalling.
* white spaceChristopher Faylor2005-02-131-2/+2
|
* * cygthread.cc (cygthread::release): Reset ev here if it exists.Christopher Faylor2005-02-111-42/+127
| | | | | | | | | | | | | | | | (cygthread::terminate_thread): Eliminat racy code which reset ev and thread_sync. Remove a few nonsensical inuse checks. Exit at the bottom. (cygthread::detach): Rewrite to again try to ensure that we don't say we're signalled when we are not signalled. * fhandler.cc (fhandler_base::raw_read): Revert to signalling read success quickly. * pipe.cc (fhandler_pipe::close): Use base method to close handle. * sigproc.h (WAIT_SIG_PRIORITY): Just trundle along at normal priority to allow the pipe thread to do its thing if possible. * pinfo.h (pinfo::zap_cwd): Declare new function. (pinfo::zap_cwd): Move 'cd out of the way code' here. (pinfo::exit): Use it here. * spawn.cc (spawn_guts): And here.
* * cygthread.cc (cygthread::detach): Just test thread handle afterCorinna Vinschen2005-02-081-1/+1
| | | | signal arrived, don't wait infinitely for it.
* * cygthread.h (cygthread::terminate_thread): Reflect return value.Christopher Faylor2005-02-061-14/+22
| | | | | | | | | | | | | | * cygthread.cc (cygthread::detach): Be more careful about ensuring that sigwait is properly waited for to avoid later missynchronization. (cygthread::terminate_thread): Return true if thread was actually terminated and all handles were closed. * fhandler_base.cc (fhandler_base::raw_read): Use signal_read_state rather than raw calls to win32 api. (fhandler_base::read): Ditto. * fhandler.h (fhandler_pipe::fixup_after_exec): Use method to create read_state signalling. (fhandler_pipe::create): Ditto. * Makefile.in: Make some more files -fomit-frame-pointer.
* * cygthread.cc (cygthread::terminate_thread): Wait briefly for notificationChristopher Faylor2005-02-011-5/+3
| | | | | | | | | | | | | | event in the event that the thread was actually in the process of exiting. * pipe.cc (fhandler_pipe::dup): read_state is not supposed to be inheritable. Fix that. * path.cc (path_conv::check): Set symlen = 0 to avoid a compiler warning. * devices.h (devices::parsedisk): Declare new function. * devices.in (devices::parsedisk): Define new function. * dtable.cc (dtable::init_std_file_from_handle): Use device numbers rather than name. * fhandler_proc.cc (format_proc_partitions): Use parsedisk to generate disk names from numeric codes. (This was broken on two of my systems previously and is still broken now)
* * cygthread.cc (new): Add a little more debugging.Christopher Faylor2005-01-291-1/+1
| | | | * thread.cc (pthread_null::exit): Add a _my_tls.remove() for safety.
* Update copyrights.Christopher Faylor2005-01-031-1/+1
|
* * cygthread.cc (cygthread::stub): Set inuse to false when exiting.Christopher Faylor2005-01-021-15/+8
| | | | | | | | | (cygthread::cygthread): Actually pass name as argument to debugging output to avoid SEGV when strace'ing. (cygthread::release): Don't set stack_ptr to NULL, since it is only set once on first entry to a stub not on each stub iteration. (cygthead::exit_thread): Remove obsolete function. * cygthread.h (cygthread::exit_thread): Ditto.
* * cygthread.cc (cygthread::stub): Add better debug output.Christopher Faylor2004-12-281-6/+10
| | | | | | | | | | | | (cygthread::cygthread): Ditto. (cygthread::terminate_thread): Ditto. Move inuse test earlier or suffer infinite loop. * pinfo.cc (_pinfo::dup_proc_pipe): Close handle if DuplicateHandle fails and process no longer exists. * spawn.cc (spawn_guts): Create process in suspended state if OS demands it. * wincap.cc: Add "start_proc_suspended" throughout. * wincap.h (wincaps): Ditto. (wincapc): Ditto.
* * cygthread.cc (cygthread::cygthread): Guard debugging variable with "ifdefChristopher Faylor2004-12-231-0/+4
| | | | | DEBUGGING". (cygthread::release): Ditto.
* * cygthread.cc (cygthread::stub): Detect if thread function wants to releaseChristopher Faylor2004-12-231-6/+20
| | | | | | | | | | | | | | | | | | itself here, to avoid a race. (cygthread::release): Clear more stuff. Add a diagnostic for an internal error. * cygthread.h (auto_release): New function. * pinfo.h (pinfo::remember): Add an argument to denote whether child is detached. * fork.cc (fork_parent): Reflect change in arguments to pinfo::remember. * pinfo.cc (_pinfo::exit): Signal exit more forcibly. (proc_waiter): Use cygthread::auto_release to signify that cygthread::stub should release the thread. This should avoid a race. (pinfo::alert_parent): Don't signify an error when wr_proc_pipe == NULL. * sigproc.cc (proc_subproc): Add support for PROC_DETACHED_CHILD. * sigproc.h: Ditto. * spawn.cc (spawn_guts): Specify whether child is detached or not when calling pinfo::remember.