Changeset 628:e1c6f45f5fcd in freeDiameter
- Timestamp:
- Dec 14, 2010, 11:53:48 AM (13 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 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 } -
include/freeDiameter/freeDiameter.h
r621 r628 676 676 677 677 678 /* The following function does not really use events, but it may be used 679 by extensions that need to start an action when the framework is fully initialized. 680 This function will block until all initializations are performed in the daemon. 681 It is meant to be used as follow by extensions: 682 - in initialization callback, create a new thread. 683 - this new thread calls this function. 684 - when the function returns, the thread can start working and using all framework features. 685 */ 686 int fd_wait_initialization_complete(void); 687 688 678 689 /***************************************/ 679 690 /* Endpoints lists helpers */
Note: See TracChangeset
for help on using the changeset viewer.