Changeset 253:ad6c0118fb50 in freeDiameter for freeDiameter/routing_dispatch.c
- Timestamp:
- Apr 13, 2010, 2:50:54 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/routing_dispatch.c
r241 r253 1070 1070 /********************************************************************************/ 1071 1071 1072 static pthread_t * dispatch = NULL; 1073 static enum thread_state * disp_state = NULL; 1074 1072 1075 /* Later: make this more dynamic */ 1073 static pthread_t dispatch = (pthread_t)NULL;1074 static enum thread_state disp_state = INITIAL;1075 1076 1076 static pthread_t rt_out = (pthread_t)NULL; 1077 1077 static enum thread_state out_state = INITIAL; … … 1083 1083 int fd_rtdisp_init(void) 1084 1084 { 1085 CHECK_POSIX( pthread_create( &dispatch, NULL, dispatch_thr, &disp_state ) ); 1085 int i; 1086 1087 /* Prepare the array for dispatch */ 1088 CHECK_MALLOC( dispatch = calloc(fd_g_config->cnf_dispthr, sizeof(pthread_t)) ); 1089 CHECK_MALLOC( disp_state = calloc(fd_g_config->cnf_dispthr, sizeof(enum thread_state)) ); 1090 1091 /* Create the threads */ 1092 for (i=0; i < fd_g_config->cnf_dispthr; i++) { 1093 CHECK_POSIX( pthread_create( &dispatch[i], NULL, dispatch_thr, &disp_state[i] ) ); 1094 } 1086 1095 CHECK_POSIX( pthread_create( &rt_out, NULL, routing_out_thr, &out_state) ); 1087 1096 CHECK_POSIX( pthread_create( &rt_in, NULL, routing_in_thr, &in_state) ); … … 1139 1148 int fd_rtdisp_fini(void) 1140 1149 { 1150 int i; 1151 1141 1152 /* Destroy the incoming queue */ 1142 1153 CHECK_FCT_DO( fd_queues_fini(&fd_g_incoming), /* ignore */); … … 1155 1166 1156 1167 /* Stop the Dispatch thread */ 1157 stop_thread_delayed(&disp_state, &dispatch, "Dispatching"); 1168 for (i=0; i < fd_g_config->cnf_dispthr; i++) { 1169 stop_thread_delayed(&disp_state[i], &dispatch[i], "Dispatching"); 1170 } 1158 1171 1159 1172 return 0;
Note: See TracChangeset
for help on using the changeset viewer.