comparison packages/kernel/current/tests/stress_threads.c @ 8:ece80412419a ecos-sw-1999-05-21

Merge from eCos master repository on 1999-05-21-22:05:54-BST
author jlarmour
date Fri, 21 May 1999 15:09:30 +0000
parents 1d7f19c9e4d1
children d3fbcdfa1b2f
comparison
equal deleted inserted replaced
7:e55593b6dcea 8:ece80412419a
296 "Priority not in use!"); 296 "Priority not in use!");
297 CYG_ASSERT(1 == handler_thread_in_use[handler_id], 297 CYG_ASSERT(1 == handler_thread_in_use[handler_id],
298 "Handler not in use!"); 298 "Handler not in use!");
299 handler_thread_in_use[handler_id]--; 299 handler_thread_in_use[handler_id]--;
300 priority_in_use[handler_pri]--; 300 priority_in_use[handler_pri]--;
301 // Finally delete the handler thread. 301
302 { 302 // Finally delete the handler thread. This must be done in a
303 // workaround for PRs 20054-20058/20065 303 // loop, waiting for the call to return true. If it returns
304 cyg_thread_kill(handlerH[handler_id]); 304 // false, go to sleep for a bit, so the killed thread gets a
305 // chance to run and complete its business.
306 while (!cyg_thread_delete(handlerH[handler_id])) {
307 cyg_thread_delay(2);
305 } 308 }
306 cyg_thread_delete(handlerH[handler_id]);
307 } cyg_mutex_unlock(&handler_slot_lock); 309 } cyg_mutex_unlock(&handler_slot_lock);
308 } 310 }
309 311
310 // Print status if time. 312 // Print status if time.
311 if (time_to_report) { 313 if (time_to_report) {
415 if (!freed) 417 if (!freed)
416 cyg_thread_delay(2); 418 cyg_thread_delay(2);
417 } while (!freed); 419 } while (!freed);
418 } 420 }
419 421
420 // Then wait for the main_program to kill us. 422 // Then exit.
421 for (;;) { 423 cyg_thread_exit();
422 cyg_thread_delay(100);
423 }
424 } 424 }
425 425
426 /* look for an available handler thread */ 426 /* look for an available handler thread */
427 int get_handler_slot(cyg_handle_t current_threadH) 427 int get_handler_slot(cyg_handle_t current_threadH)
428 { 428 {