* cygtls.h (_cygtls::will_wait_for_signal): Rename from 'signal_waiting' to

something more expressive.  Reflect rename throughout.
(_cygtls::get_signal_arrived): Rename from create_signal_arrived.  Move lock
here.
(_cygtls::set_signal_arrived): Use get_signal_arrived.
* exceptions.cc (_cygtls::interrupt_setup): Use get_signal_arrived.
* tlsoffsets.h: Regenerate.
This commit is contained in:
Christopher Faylor 2012-12-04 20:26:18 +00:00
parent 8f9046ae61
commit 3211ef434d
4 changed files with 31 additions and 23 deletions

View File

@ -1,3 +1,14 @@
2012-12-04 Christopher Faylor <me.cygwin2012@cgf.cx>
* cygtls.h (_cygtls::will_wait_for_signal): Rename from
'signal_waiting' to something more expressive. Reflect rename
throughout.
(_cygtls::get_signal_arrived): Rename from create_signal_arrived. Move
lock here.
(_cygtls::set_signal_arrived): Use get_signal_arrived.
* exceptions.cc (_cygtls::interrupt_setup): Use get_signal_arrived.
* tlsoffsets.h: Regenerate.
2012-11-30 Christopher Faylor <me.cygwin2012@cgf.cx> 2012-11-30 Christopher Faylor <me.cygwin2012@cgf.cx>
* spawn.cc (child_info_spawn::worker): Make detection of '/c' case * spawn.cc (child_info_spawn::worker): Make detection of '/c' case

View File

@ -187,7 +187,7 @@ public:
sigset_t sigwait_mask; sigset_t sigwait_mask;
siginfo_t *sigwait_info; siginfo_t *sigwait_info;
HANDLE signal_arrived; HANDLE signal_arrived;
bool signal_waiting; bool will_wait_for_signal;
struct ucontext thread_context; struct ucontext thread_context;
DWORD thread_id; DWORD thread_id;
siginfo_t infodata; siginfo_t infodata;
@ -233,27 +233,28 @@ public:
void lock () __attribute__ ((regparm (1))); void lock () __attribute__ ((regparm (1)));
void unlock () __attribute__ ((regparm (1))); void unlock () __attribute__ ((regparm (1)));
bool locked () __attribute__ ((regparm (1))); bool locked () __attribute__ ((regparm (1)));
void create_signal_arrived () HANDLE get_signal_arrived ()
{
signal_arrived = CreateEvent (&sec_none_nih, false, false, NULL);
}
void set_signal_arrived (bool setit, HANDLE& h)
{
if (!setit)
signal_waiting = false;
else
{ {
if (!signal_arrived) if (!signal_arrived)
{ {
lock (); lock ();
create_signal_arrived (); if (!signal_arrived)
signal_arrived = CreateEvent (&sec_none_nih, false, false, NULL);
unlock (); unlock ();
} }
h = signal_arrived; return signal_arrived;
signal_waiting = true; }
void set_signal_arrived (bool setit, HANDLE& h)
{
if (!setit)
will_wait_for_signal = false;
else
{
h = get_signal_arrived ();
will_wait_for_signal = true;
} }
} }
void reset_signal_arrived () { signal_waiting = false; } void reset_signal_arrived () { will_wait_for_signal = false; }
private: private:
void call2 (DWORD (*) (void *, void *), void *, void *) __attribute__ ((regparm (3))); void call2 (DWORD (*) (void *, void *), void *, void *) __attribute__ ((regparm (3)));
/*gentls_offsets*/ /*gentls_offsets*/
@ -327,7 +328,7 @@ public:
set_signal_arrived (bool setit, HANDLE& h) { _my_tls.set_signal_arrived (setit, h); } set_signal_arrived (bool setit, HANDLE& h) { _my_tls.set_signal_arrived (setit, h); }
set_signal_arrived (HANDLE& h) { _my_tls.set_signal_arrived (true, h); } set_signal_arrived (HANDLE& h) { _my_tls.set_signal_arrived (true, h); }
operator int () const {return _my_tls.signal_waiting;} operator int () const {return _my_tls.will_wait_for_signal;}
~set_signal_arrived () { _my_tls.reset_signal_arrived (); } ~set_signal_arrived () { _my_tls.reset_signal_arrived (); }
}; };

View File

@ -799,11 +799,7 @@ _cygtls::interrupt_setup (siginfo_t& si, void *handler, struct sigaction& siga)
this->sig = si.si_signo; // Should always be last thing set to avoid a race this->sig = si.si_signo; // Should always be last thing set to avoid a race
if (incyg) if (incyg)
{ SetEvent (get_signal_arrived ());
if (!signal_arrived)
create_signal_arrived ();
SetEvent (signal_arrived);
}
proc_subproc (PROC_CLEARWAIT, 1); proc_subproc (PROC_CLEARWAIT, 1);
sigproc_printf ("armed signal_arrived %p, signal %d", signal_arrived, si.si_signo); sigproc_printf ("armed signal_arrived %p, signal %d", signal_arrived, si.si_signo);

View File

@ -27,8 +27,8 @@
//; $tls::psigwait_info = 2584; //; $tls::psigwait_info = 2584;
//; $tls::signal_arrived = -10112; //; $tls::signal_arrived = -10112;
//; $tls::psignal_arrived = 2588; //; $tls::psignal_arrived = 2588;
//; $tls::signal_waiting = -10108; //; $tls::will_wait_for_signal = -10108;
//; $tls::psignal_waiting = 2592; //; $tls::pwill_wait_for_signal = 2592;
//; $tls::thread_context = -10104; //; $tls::thread_context = -10104;
//; $tls::pthread_context = 2596; //; $tls::pthread_context = 2596;
//; $tls::thread_id = -9892; //; $tls::thread_id = -9892;
@ -85,8 +85,8 @@
#define tls_psigwait_info (2584) #define tls_psigwait_info (2584)
#define tls_signal_arrived (-10112) #define tls_signal_arrived (-10112)
#define tls_psignal_arrived (2588) #define tls_psignal_arrived (2588)
#define tls_signal_waiting (-10108) #define tls_will_wait_for_signal (-10108)
#define tls_psignal_waiting (2592) #define tls_pwill_wait_for_signal (2592)
#define tls_thread_context (-10104) #define tls_thread_context (-10104)
#define tls_pthread_context (2596) #define tls_pthread_context (2596)
#define tls_thread_id (-9892) #define tls_thread_id (-9892)