Changeset 1182:cc96a4dfb3d1 in freeDiameter for libfdcore
- Timestamp:
- Jun 6, 2013, 12:25:23 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdcore/core.c
r1167 r1182 228 228 } 229 229 230 static pthread_mutex_t core_lock = PTHREAD_MUTEX_INITIALIZER; 231 230 232 /* Parse the freeDiameter.conf configuration file, load the extensions */ 231 int fd_core_parseconf(const char * conffile)233 static int fd_core_parseconf_int(const char * conffile) 232 234 { 233 235 char * buf = NULL, *b; … … 274 276 } 275 277 278 int fd_core_parseconf(const char * conffile) 279 { 280 int ret; 281 CHECK_POSIX( pthread_mutex_lock(&core_lock) ); 282 ret = fd_core_parseconf_int(conffile); 283 CHECK_POSIX( pthread_mutex_unlock(&core_lock) ); 284 return ret; 285 } 286 287 276 288 /* For threads that would need to wait complete start of the framework (ex: in extensions) */ 277 289 int fd_core_waitstartcomplete(void) … … 283 295 284 296 /* Start the server & client threads */ 285 int fd_core_start(void)297 static int fd_core_start_int(void) 286 298 { 287 299 /* Start server threads */ … … 301 313 } 302 314 315 int fd_core_start(void) 316 { 317 int ret; 318 CHECK_POSIX( pthread_mutex_lock(&core_lock) ); 319 ret = fd_core_start_int(); 320 CHECK_POSIX( pthread_mutex_unlock(&core_lock) ); 321 return ret; 322 } 303 323 304 324 /* Initialize shutdown of the framework. This is not blocking. */ … … 308 328 309 329 if (cur_state < CORE_RUNNING) { 330 /* Calling application must make sure the initialization is not ongoing in a separate thread... */ 331 if (pthread_mutex_lock(&core_lock) != 0) { 332 /* This function must not be called asynchronously from fd_core_parseconf / fd_core_start ! Please review your main app design */ 333 ASSERT(0); 334 return EINVAL; 335 } 310 336 core_shutdown(); 311 337 core_state_set(CORE_TERM); 338 pthread_mutex_unlock(&core_lock); 312 339 } else if (cur_state == CORE_RUNNING) { 313 340 core_state_set(CORE_SHUTDOWN);
Note: See TracChangeset
for help on using the changeset viewer.