Changeset 628:e1c6f45f5fcd in freeDiameter for freeDiameter/main.c
- Timestamp:
- Dec 14, 2010, 11:53:48 AM (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/main.c
r502 r628 46 46 static void main_version(void); 47 47 static void main_help( void ); 48 static int signal_framework_ready(void); 48 49 49 50 /* The static configuration structure */ … … 118 119 /* Now, just wait for events */ 119 120 TRACE_DEBUG(INFO, FD_PROJECT_BINARY " daemon initialized."); 121 CHECK_FCT( signal_framework_ready() ); 120 122 while (1) { 121 123 int code; size_t sz; void * data; … … 350 352 return; 351 353 } 354 355 356 /* Signal extensions when the framework is completly initialized */ 357 static int is_ready = 0; 358 static pthread_mutex_t is_ready_mtx = PTHREAD_MUTEX_INITIALIZER; 359 static pthread_cond_t is_ready_cnd = PTHREAD_COND_INITIALIZER; 360 static int signal_framework_ready(void) 361 { 362 TRACE_ENTRY(""); 363 CHECK_POSIX( pthread_mutex_lock( &is_ready_mtx ) ); 364 is_ready = 1; 365 CHECK_POSIX( pthread_cond_broadcast( &is_ready_cnd ) ); 366 CHECK_POSIX( pthread_mutex_unlock( &is_ready_mtx ) ); 367 return 0; 368 } 369 int fd_wait_initialization_complete(void) 370 { 371 TRACE_ENTRY(""); 372 CHECK_POSIX( pthread_mutex_lock( &is_ready_mtx ) ); 373 pthread_cleanup_push( fd_cleanup_mutex, &is_ready_mtx ); 374 while (!is_ready) { 375 CHECK_POSIX( pthread_cond_wait( &is_ready_cnd, &is_ready_mtx ) ); 376 } 377 pthread_cleanup_pop( 0 ); 378 CHECK_POSIX( pthread_mutex_unlock( &is_ready_mtx ) ); 379 return 0; 380 }
Note: See TracChangeset
for help on using the changeset viewer.