version 1.16, 2000/12/22 04:06:37 |
version 1.17, 2002/04/11 14:13:37 |
|
|
/* -*- mode: C; coding: euc-japan -*- */ |
/* -*- mode: C; coding: euc-japan -*- */ |
/* $OpenXM: OpenXM/src/ox_math/serv1.c,v 1.15 2000/12/07 10:04:56 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/ox_math/serv1.c,v 1.16 2000/12/22 04:06:37 ohara Exp $ */ |
|
|
/* |
/* |
Copyright (C) Katsuyoshi OHARA, 2000. |
Copyright (C) Katsuyoshi OHARA, 2000. |
Line 23 extern OXFILE *stack_oxfp; |
|
Line 23 extern OXFILE *stack_oxfp; |
|
/* SM_control_reset_connection */ |
/* SM_control_reset_connection */ |
static void handler() |
static void handler() |
{ |
{ |
int mask = sigsetmask(sigmask(SIGUSR1)); |
sigset_t newmask, oldmask; |
|
sigemptyset(&newmask); |
|
sigaddset(&newmask, SIGUSR1); |
|
sigprocmask(SIG_SETMASK, &newmask, &oldmask); |
fprintf(stderr, "signal received.\n"); |
fprintf(stderr, "signal received.\n"); |
exchange_ox_sync_ball(stack_oxfp); |
exchange_ox_sync_ball(stack_oxfp); |
sigsetmask(mask); /* unmasked. */ |
sigprocmask(SIG_SETMASK, &oldmask, NULL); /* unmasked. */ |
} |
} |
|
|
static int exchange_ox_sync_ball(OXFILE *oxfp) |
static int exchange_ox_sync_ball(OXFILE *oxfp) |
Line 92 int sm_receive_ox() |
|
Line 95 int sm_receive_ox() |
|
|
|
int sm(OXFILE *oxfp) |
int sm(OXFILE *oxfp) |
{ |
{ |
int mask = siggetmask(); |
|
fd_set fdmask; |
fd_set fdmask; |
stack_oxfp = oxfp; |
stack_oxfp = oxfp; |
stack_extend(); |
stack_extend(); |
Line 103 int sm(OXFILE *oxfp) |
|
Line 105 int sm(OXFILE *oxfp) |
|
|
|
while(1) { |
while(1) { |
if (select(2, &fdmask, NULL, NULL, NULL) > 0) { |
if (select(2, &fdmask, NULL, NULL, NULL) > 0) { |
sigsetmask(sigmask(SIGUSR1)); |
sigset_t newmask, oldmask; |
|
sigemptyset(&newmask); |
|
sigaddset(&newmask, SIGUSR1); |
|
sigprocmask(SIG_SETMASK, &newmask, &oldmask); |
sm_receive_ox(); |
sm_receive_ox(); |
|
sigprocmask(SIG_SETMASK, &oldmask, NULL); /* unmasked. */ |
} |
} |
sigsetmask(mask); /* unmasked. */ |
|
} |
} |
fprintf(stderr, "SM: socket(%d) is closed.\n", stack_oxfp->fd); |
fprintf(stderr, "SM: socket(%d) is closed.\n", stack_oxfp->fd); |
} |
} |