comparison src/recpt1.c @ 185:7a0f498af035 default tip

Fix a race condition.
author Naoya OYAMA <naoya.oyama@gmail.com>
date Wed, 14 May 2014 22:43:57 +0900
parents dc0d3addfd18
children
comparison
equal deleted inserted replaced
184:dc0d3addfd18 185:7a0f498af035
202 strcmp(tdata->ch, channel))) { 202 strcmp(tdata->ch, channel))) {
203 // 物理チャンネル変更時には splitter は強制的に再起動させる 203 // 物理チャンネル変更時には splitter は強制的に再起動させる
204 pthread_mutex_lock(&tdata->splitter_mutex); 204 pthread_mutex_lock(&tdata->splitter_mutex);
205 split_shutdown(splitter); 205 split_shutdown(splitter);
206 splitter = split_startup(sid_list); 206 splitter = split_startup(sid_list);
207 time(&splitter->split_start_time);
207 if (splitter->sid_list == NULL) { 208 if (splitter->sid_list == NULL) {
208 fprintf (stderr, "reader_func() splitter RESTART FAILED.\n"); 209 fprintf (stderr, "reader_func() splitter RESTART FAILED.\n");
209 tdata->splitter = NULL; 210 tdata->splitter = NULL;
210 pthread_mutex_unlock(&tdata->splitter_mutex); 211 pthread_mutex_unlock(&tdata->splitter_mutex);
211 continue; 212 continue;
229 } 230 }
230 pthread_mutex_unlock(&tdata->stream_queue->mutex); 231 pthread_mutex_unlock(&tdata->stream_queue->mutex);
231 } 232 }
232 tdata->table = table; 233 tdata->table = table;
233 tdata->splitter = splitter; 234 tdata->splitter = splitter;
234 time(&splitter->split_start_time);
235 strncpy(tdata->sid_list, sid_list, sizeof(tdata->sid_list)); 235 strncpy(tdata->sid_list, sid_list, sizeof(tdata->sid_list));
236 pthread_mutex_unlock(&tdata->splitter_mutex); 236 pthread_mutex_unlock(&tdata->splitter_mutex);
237 } 237 }
238 238
239 if (stop_rec) { 239 if (stop_rec) {