/[hydra]/hydra/src/loop_signals.h
ViewVC logotype

Contents of /hydra/src/loop_signals.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Wed Jan 22 07:51:50 2003 UTC (21 years, 2 months ago) by nmav
Branch: MAIN
CVS Tags: hydra_0_1_6_without_hic, hydra_0_1_7, hydra_0_1_6, hydra_0_1_4, hydra_0_1_8, HEAD
Changes since 1.1: +22 -0 lines
File MIME type: text/plain
merged changes from 0.1.x branch.

1
2 #ifdef ENABLE_SMP
3 extern pthread_t father_id;
4 #endif
5
6 #ifdef ENABLE_SMP
7 # define IS_FATHER() pthread_equal( params->tid, father_id)
8 #else
9 /* in non smp case we have only one thread, which is the father.
10 */
11 # define IS_FATHER() 1
12 #endif
13
14 #define SET_TIMEOUT( timeout, factor, infinity) \
15 if (params->request_ready) \
16 timeout = 0; \
17 else if (params->request_block) \
18 timeout = (ka_timeout ? ka_timeout * factor : REQUEST_TIMEOUT * factor); \
19 else { \
20 /* The father thread, has to update the timestamp. \
21 */ \
22 if (IS_FATHER()) \
23 timeout = (REQUEST_TIMEOUT/2) * factor; \
24 else timeout = infinity; \
25 }
26
27
28 inline static void handle_signals( server_params* params)
29 {
30
31 if (params->sigchld_flag)
32 sigchld_run();
33
34 #ifdef ENABLE_SMP
35 /* Only the main thread handles signals.
36 */
37 if (pthread_equal( params->tid, father_id)) {
38 #endif
39 /* Calculate current time. Moved here, so only one thread
40 * calls this.
41 */
42 time(&current_time);
43
44 if (params->sigalrm_flag)
45 sigalrm_run();
46 if (params->sigusr1_flag)
47 sigusr1_run();
48 if (params->sigterm_flag) {
49 if (params->sigterm_flag == 1) {
50 sigterm_stage1_run();
51 }
52 if (params->sigterm_flag == 2 && !params->request_ready && !params->request_block) {
53 sigterm_stage2_run();
54 }
55 params->server_s[0].pending_requests = 0;
56 params->server_s[1].pending_requests = 0;
57 }
58 #ifdef ENABLE_SMP
59 }
60 #endif
61
62 /* the whole family calls this
63 */
64 if (params->sighup_flag)
65 sighup_run();
66
67 }

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26