(empth_start, empth_init, empth_alarm) [_EMPTH_POSIX]: We do raise
SIGALRM! Revert rev. 1.21. (empth_alarm): Internal linkage.
This commit is contained in:
parent
16fe285ec7
commit
a540be8fe3
1 changed files with 23 additions and 1 deletions
|
@ -88,7 +88,7 @@ static void **udata;
|
||||||
static pthread_mutex_t mtx_ctxsw;
|
static pthread_mutex_t mtx_ctxsw;
|
||||||
|
|
||||||
static void empth_status(char *format, ...) ATTRIBUTE((format (printf, 1, 2)));
|
static void empth_status(char *format, ...) ATTRIBUTE((format (printf, 1, 2)));
|
||||||
|
static void empth_alarm(int sig);
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
empth_start(void *arg)
|
empth_start(void *arg)
|
||||||
|
@ -110,6 +110,9 @@ empth_start(void *arg)
|
||||||
act.sa_handler = SIG_IGN;
|
act.sa_handler = SIG_IGN;
|
||||||
sigaction(SIGPIPE, &act, NULL);
|
sigaction(SIGPIPE, &act, NULL);
|
||||||
|
|
||||||
|
act.sa_handler = empth_alarm;
|
||||||
|
sigaction(SIGALRM, &act, NULL);
|
||||||
|
|
||||||
ctx->id = pthread_self();
|
ctx->id = pthread_self();
|
||||||
pthread_setspecific(ctx_key, ctx);
|
pthread_setspecific(ctx_key, ctx);
|
||||||
pthread_mutex_lock(&mtx_ctxsw);
|
pthread_mutex_lock(&mtx_ctxsw);
|
||||||
|
@ -154,11 +157,17 @@ int
|
||||||
empth_init(void **ctx_ptr, int flags)
|
empth_init(void **ctx_ptr, int flags)
|
||||||
{
|
{
|
||||||
empth_t *ctx;
|
empth_t *ctx;
|
||||||
|
struct sigaction act;
|
||||||
|
|
||||||
|
|
||||||
pthread_key_create(&ctx_key, NULL);
|
pthread_key_create(&ctx_key, NULL);
|
||||||
pthread_mutex_init(&mtx_ctxsw, NULL);
|
pthread_mutex_init(&mtx_ctxsw, NULL);
|
||||||
|
|
||||||
|
act.sa_flags = 0;
|
||||||
|
sigemptyset(&act.sa_mask);
|
||||||
|
act.sa_handler = empth_alarm;
|
||||||
|
sigaction(SIGALRM, &act, NULL);
|
||||||
|
|
||||||
udata = ctx_ptr;
|
udata = ctx_ptr;
|
||||||
ctx = malloc(sizeof(empth_t));
|
ctx = malloc(sizeof(empth_t));
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
|
@ -354,6 +363,19 @@ empth_select(int fd, int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
empth_alarm(int sig)
|
||||||
|
{
|
||||||
|
struct sigaction act;
|
||||||
|
empth_status("got alarm signal");
|
||||||
|
#ifdef SA_RESTART
|
||||||
|
act.sa_flags &= ~SA_RESTART;
|
||||||
|
#endif
|
||||||
|
sigemptyset(&act.sa_mask);
|
||||||
|
act.sa_handler = empth_alarm;
|
||||||
|
sigaction(SIGALRM, &act, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
empth_wakeup(empth_t *a)
|
empth_wakeup(empth_t *a)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue