Changeset 2826 for pjproject/trunk/pjlib/src/pjlib-test/ioq_unreg.c
- Timestamp:
- Jul 2, 2009 8:24:22 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pjlib-test/ioq_unreg.c
r2782 r2826 94 94 sock_data.unregistered = 1; 95 95 pj_ioqueue_unregister(key); 96 pj_mutex_destroy(sock_data.mutex);97 pj_pool_release(sock_data.pool);98 sock_data.pool = NULL;99 96 return; 100 97 } … … 244 241 for (;;) { 245 242 pj_time_val now, timeout; 243 int n; 246 244 247 245 pj_gettimeofday(&now); … … 249 247 if (test_method == UNREGISTER_IN_APP && 250 248 PJ_TIME_VAL_GTE(now, time_to_unregister) && 251 sock_data.pool)249 !sock_data.unregistered) 252 250 { 253 //Can't do this otherwise it'll deadlock254 //pj_mutex_lock(sock_data.mutex);255 256 251 sock_data.unregistered = 1; 252 /* Wait (as much as possible) for callback to complete */ 253 pj_mutex_lock(sock_data.mutex); 254 pj_mutex_unlock(sock_data.mutex); 257 255 pj_ioqueue_unregister(sock_data.key); 258 //pj_mutex_unlock(sock_data.mutex);259 pj_mutex_destroy(sock_data.mutex);260 pj_pool_release(sock_data.pool);261 sock_data.pool = NULL;262 256 } 263 257 … … 266 260 267 261 timeout.sec = 0; timeout.msec = 10; 268 pj_ioqueue_poll(ioqueue, &timeout); 269 //pj_thread_sleep(1); 270 262 n = pj_ioqueue_poll(ioqueue, &timeout); 263 if (n < 0) { 264 app_perror("pj_ioqueue_poll error", -n); 265 pj_thread_sleep(1); 266 } 271 267 } 272 268 … … 277 273 pj_thread_destroy(thread[i]); 278 274 } 275 276 /* Destroy data */ 277 pj_mutex_destroy(sock_data.mutex); 278 pj_pool_release(sock_data.pool); 279 sock_data.pool = NULL; 279 280 280 281 if (other_socket) { … … 315 316 } 316 317 317 PJ_LOG(3, (THIS_FILE, "...ioqueue unregister stress test 0/3 (%s)",318 PJ_LOG(3, (THIS_FILE, "...ioqueue unregister stress test 0/3, unregister in app (%s)", 318 319 pj_ioqueue_name())); 319 320 for (i=0; i<LOOP; ++i) { … … 325 326 326 327 327 PJ_LOG(3, (THIS_FILE, "...ioqueue unregister stress test 1/3 (%s)",328 PJ_LOG(3, (THIS_FILE, "...ioqueue unregister stress test 1/3, unregister in app (%s)", 328 329 pj_ioqueue_name())); 329 330 for (i=0; i<LOOP; ++i) { … … 336 337 test_method = UNREGISTER_IN_CALLBACK; 337 338 338 PJ_LOG(3, (THIS_FILE, "...ioqueue unregister stress test 2/3 (%s)",339 PJ_LOG(3, (THIS_FILE, "...ioqueue unregister stress test 2/3, unregister in cb (%s)", 339 340 pj_ioqueue_name())); 340 341 for (i=0; i<LOOP; ++i) { … … 346 347 347 348 348 PJ_LOG(3, (THIS_FILE, "...ioqueue unregister stress test 3/3 (%s)",349 PJ_LOG(3, (THIS_FILE, "...ioqueue unregister stress test 3/3, unregister in cb (%s)", 349 350 pj_ioqueue_name())); 350 351 for (i=0; i<LOOP; ++i) { … … 367 368 rc = udp_ioqueue_unreg_test_imp(PJ_TRUE); 368 369 if (rc != 0) 369 return rc;370 return rc; 370 371 371 372 rc = udp_ioqueue_unreg_test_imp(PJ_FALSE);
Note: See TracChangeset
for help on using the changeset viewer.