Changeset caaa47c in rtems
- Timestamp:
- 12/01/95 21:08:03 (28 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 8d0b7d96
- Parents:
- ed32907
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/score/src/threadq.c
red32907 rcaaa47c 113 113 &the_thread->Timer, 114 114 timeout, 115 WATCHDOG_ NO_ACTIVATE115 WATCHDOG_ACTIVATE_NOW 116 116 ); 117 117 } … … 122 122 break; 123 123 case THREAD_QUEUE_DISCIPLINE_PRIORITY: 124 _Thread_queue_Enqueue_priority( 125 the_thread_queue, the_thread, timeout ); 124 _Thread_queue_Enqueue_priority( the_thread_queue, the_thread, timeout ); 126 125 break; 127 126 } … … 151 150 { 152 151 Thread_Control *the_thread; 153 ISR_Level level;154 152 155 153 switch ( the_thread_queue->discipline ) { … … 165 163 } 166 164 167 if ( !_Thread_Is_null( the_thread ) ) 168 return( the_thread ); 169 170 _ISR_Disable( level ); 171 if ( the_thread_queue->sync == FALSE ) { 172 _ISR_Enable( level ); 173 return( NULL ); 174 } 175 176 the_thread_queue->sync = FALSE; 177 _ISR_Enable( level ); 178 return( _Thread_Executing ); 165 return( the_thread ); 179 166 } 180 167 … … 332 319 ) 333 320 { 334 Thread_Control *the_thread; 335 Objects_Locations location; 321 Thread_Control *the_thread; 322 Thread_queue_Control *the_thread_queue; 323 Objects_Locations location; 336 324 337 325 the_thread = _Thread_Get( id, &location ); … … 341 329 break; 342 330 case OBJECTS_LOCAL: 343 the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; 344 _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); 331 the_thread_queue = the_thread->Wait.queue; 332 333 if ( the_thread_queue->sync == TRUE && _Thread_Is_executing(the_thread)) { 334 if ( the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED ) 335 the_thread_queue->sync_state = THREAD_QUEUE_TIMEOUT; 336 } else { 337 the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; 338 _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); 339 } 345 340 _Thread_Unnest_dispatch(); 346 341 break; … … 375 370 376 371 _ISR_Disable( level ); 377 if ( the_thread_queue->sync == TRUE ) { 378 the_thread_queue->sync = FALSE; 379 380 _Chain_Append_unprotected( 381 &the_thread_queue->Queues.Fifo, 382 &the_thread->Object.Node 383 ); 384 385 if ( timeout != WATCHDOG_NO_TIMEOUT ) 386 _Watchdog_Activate( &the_thread->Timer ); 387 388 _ISR_Enable( level ); 389 return; 390 } 391 392 if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { 393 _ISR_Enable( level ); 394 _Thread_Unblock( the_thread ); 395 } else { 396 _Watchdog_Deactivate( &the_thread->Timer ); 397 _ISR_Enable( level ); 398 (void) _Watchdog_Remove( &the_thread->Timer ); 399 _Thread_Unblock( the_thread ); 400 } 372 373 switch ( the_thread_queue->sync_state ) { 374 case THREAD_QUEUE_NOTHING_HAPPENED: 375 the_thread_queue->sync = FALSE; 376 _Chain_Append_unprotected( 377 &the_thread_queue->Queues.Fifo, 378 &the_thread->Object.Node 379 ); 380 _ISR_Enable( level ); 381 return; 382 383 case THREAD_QUEUE_TIMEOUT: 384 the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; 385 _ISR_Enable( level ); 386 break; 387 388 case THREAD_QUEUE_SATISFIED: 389 if ( _Watchdog_Is_active( &the_thread->Timer ) ) { 390 _Watchdog_Deactivate( &the_thread->Timer ); 391 _ISR_Enable( level ); 392 (void) _Watchdog_Remove( &the_thread->Timer ); 393 } else 394 _ISR_Enable( level ); 395 break; 396 } 397 398 /* 399 * Global objects with thread queue's should not be operated on from an 400 * ISR. But the sync code still must allow short timeouts to be processed 401 * correctly. 402 */ 403 404 _Thread_Unblock( the_thread ); 401 405 402 406 if ( !_Objects_Is_local_id( the_thread->Object.id ) ) … … 448 452 _Thread_MP_Free_proxy( the_thread ); 449 453 450 return( the_thread ); 451 } 452 _ISR_Enable( level ); 453 return( NULL ); 454 return the_thread; 455 } else if ( the_thread_queue->sync ) { 456 the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; 457 _ISR_Enable( level ); 458 return _Thread_Executing; 459 } else { 460 _ISR_Enable( level ); 461 return NULL; 462 } 454 463 } 455 464 … … 598 607 (Thread_Control *)search_thread->Object.Node.next; 599 608 } 600 if ( the_thread_queue->sync == FALSE)609 if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) 601 610 goto syncronize; 602 611 603 612 the_thread_queue->sync = FALSE; 604 if ( timeout != WATCHDOG_NO_TIMEOUT )605 _Watchdog_Activate( &the_thread->Timer );606 613 607 614 if ( priority == search_priority ) … … 644 651 search_thread->Object.Node.previous; 645 652 } 646 if ( !the_thread_queue->sync)653 if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) 647 654 goto syncronize; 648 655 649 656 the_thread_queue->sync = FALSE; 650 if ( timeout != WATCHDOG_NO_TIMEOUT )651 _Watchdog_Activate( &the_thread->Timer );652 657 653 658 if ( priority == search_priority ) … … 678 683 679 684 syncronize: 680 if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { 681 _ISR_Enable( level ); 682 _Thread_Unblock( the_thread ); 683 } else { 684 _Watchdog_Deactivate( &the_thread->Timer ); 685 _ISR_Enable( level ); 686 (void) _Watchdog_Remove( &the_thread->Timer ); 687 _Thread_Unblock( the_thread ); 688 } 685 686 switch ( the_thread_queue->sync_state ) { 687 case THREAD_QUEUE_NOTHING_HAPPENED: 688 /* 689 * All of this was dealt with above. This should never happen. 690 */ 691 break; 692 693 case THREAD_QUEUE_TIMEOUT: 694 the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; 695 _ISR_Enable( level ); 696 break; 697 698 case THREAD_QUEUE_SATISFIED: 699 if ( _Watchdog_Is_active( &the_thread->Timer ) ) { 700 _Watchdog_Deactivate( &the_thread->Timer ); 701 _ISR_Enable( level ); 702 (void) _Watchdog_Remove( &the_thread->Timer ); 703 } else 704 _ISR_Enable( level ); 705 break; 706 } 707 708 /* 709 * Global objects with thread queue's should not be operated on from an 710 * ISR. But the sync code still must allow short timeouts to be processed 711 * correctly. 712 */ 713 714 _Thread_Unblock( the_thread ); 715 689 716 if ( !_Objects_Is_local_id( the_thread->Object.id ) ) 690 717 _Thread_MP_Free_proxy( the_thread ); … … 722 749 Chain_Node *previous_node; 723 750 751 _ISR_Disable( level ); 724 752 for( index=0 ; 725 753 index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ; 726 754 index++ ) { 727 _ISR_Disable( level );728 755 if ( !_Chain_Is_empty( &the_thread_queue->Queues.Priority[ index ] ) ) { 729 756 the_thread = (Thread_Control *) … … 731 758 goto dequeue; 732 759 } 760 } 761 762 if ( the_thread_queue->sync ) { 763 the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; 733 764 _ISR_Enable( level ); 734 } 765 return _Thread_Executing; 766 } 767 768 _ISR_Enable( level ); 735 769 return NULL; 736 770 -
cpukit/score/src/threadq.c
red32907 rcaaa47c 113 113 &the_thread->Timer, 114 114 timeout, 115 WATCHDOG_ NO_ACTIVATE115 WATCHDOG_ACTIVATE_NOW 116 116 ); 117 117 } … … 122 122 break; 123 123 case THREAD_QUEUE_DISCIPLINE_PRIORITY: 124 _Thread_queue_Enqueue_priority( 125 the_thread_queue, the_thread, timeout ); 124 _Thread_queue_Enqueue_priority( the_thread_queue, the_thread, timeout ); 126 125 break; 127 126 } … … 151 150 { 152 151 Thread_Control *the_thread; 153 ISR_Level level;154 152 155 153 switch ( the_thread_queue->discipline ) { … … 165 163 } 166 164 167 if ( !_Thread_Is_null( the_thread ) ) 168 return( the_thread ); 169 170 _ISR_Disable( level ); 171 if ( the_thread_queue->sync == FALSE ) { 172 _ISR_Enable( level ); 173 return( NULL ); 174 } 175 176 the_thread_queue->sync = FALSE; 177 _ISR_Enable( level ); 178 return( _Thread_Executing ); 165 return( the_thread ); 179 166 } 180 167 … … 332 319 ) 333 320 { 334 Thread_Control *the_thread; 335 Objects_Locations location; 321 Thread_Control *the_thread; 322 Thread_queue_Control *the_thread_queue; 323 Objects_Locations location; 336 324 337 325 the_thread = _Thread_Get( id, &location ); … … 341 329 break; 342 330 case OBJECTS_LOCAL: 343 the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; 344 _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); 331 the_thread_queue = the_thread->Wait.queue; 332 333 if ( the_thread_queue->sync == TRUE && _Thread_Is_executing(the_thread)) { 334 if ( the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED ) 335 the_thread_queue->sync_state = THREAD_QUEUE_TIMEOUT; 336 } else { 337 the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; 338 _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); 339 } 345 340 _Thread_Unnest_dispatch(); 346 341 break; … … 375 370 376 371 _ISR_Disable( level ); 377 if ( the_thread_queue->sync == TRUE ) { 378 the_thread_queue->sync = FALSE; 379 380 _Chain_Append_unprotected( 381 &the_thread_queue->Queues.Fifo, 382 &the_thread->Object.Node 383 ); 384 385 if ( timeout != WATCHDOG_NO_TIMEOUT ) 386 _Watchdog_Activate( &the_thread->Timer ); 387 388 _ISR_Enable( level ); 389 return; 390 } 391 392 if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { 393 _ISR_Enable( level ); 394 _Thread_Unblock( the_thread ); 395 } else { 396 _Watchdog_Deactivate( &the_thread->Timer ); 397 _ISR_Enable( level ); 398 (void) _Watchdog_Remove( &the_thread->Timer ); 399 _Thread_Unblock( the_thread ); 400 } 372 373 switch ( the_thread_queue->sync_state ) { 374 case THREAD_QUEUE_NOTHING_HAPPENED: 375 the_thread_queue->sync = FALSE; 376 _Chain_Append_unprotected( 377 &the_thread_queue->Queues.Fifo, 378 &the_thread->Object.Node 379 ); 380 _ISR_Enable( level ); 381 return; 382 383 case THREAD_QUEUE_TIMEOUT: 384 the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; 385 _ISR_Enable( level ); 386 break; 387 388 case THREAD_QUEUE_SATISFIED: 389 if ( _Watchdog_Is_active( &the_thread->Timer ) ) { 390 _Watchdog_Deactivate( &the_thread->Timer ); 391 _ISR_Enable( level ); 392 (void) _Watchdog_Remove( &the_thread->Timer ); 393 } else 394 _ISR_Enable( level ); 395 break; 396 } 397 398 /* 399 * Global objects with thread queue's should not be operated on from an 400 * ISR. But the sync code still must allow short timeouts to be processed 401 * correctly. 402 */ 403 404 _Thread_Unblock( the_thread ); 401 405 402 406 if ( !_Objects_Is_local_id( the_thread->Object.id ) ) … … 448 452 _Thread_MP_Free_proxy( the_thread ); 449 453 450 return( the_thread ); 451 } 452 _ISR_Enable( level ); 453 return( NULL ); 454 return the_thread; 455 } else if ( the_thread_queue->sync ) { 456 the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; 457 _ISR_Enable( level ); 458 return _Thread_Executing; 459 } else { 460 _ISR_Enable( level ); 461 return NULL; 462 } 454 463 } 455 464 … … 598 607 (Thread_Control *)search_thread->Object.Node.next; 599 608 } 600 if ( the_thread_queue->sync == FALSE)609 if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) 601 610 goto syncronize; 602 611 603 612 the_thread_queue->sync = FALSE; 604 if ( timeout != WATCHDOG_NO_TIMEOUT )605 _Watchdog_Activate( &the_thread->Timer );606 613 607 614 if ( priority == search_priority ) … … 644 651 search_thread->Object.Node.previous; 645 652 } 646 if ( !the_thread_queue->sync)653 if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) 647 654 goto syncronize; 648 655 649 656 the_thread_queue->sync = FALSE; 650 if ( timeout != WATCHDOG_NO_TIMEOUT )651 _Watchdog_Activate( &the_thread->Timer );652 657 653 658 if ( priority == search_priority ) … … 678 683 679 684 syncronize: 680 if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { 681 _ISR_Enable( level ); 682 _Thread_Unblock( the_thread ); 683 } else { 684 _Watchdog_Deactivate( &the_thread->Timer ); 685 _ISR_Enable( level ); 686 (void) _Watchdog_Remove( &the_thread->Timer ); 687 _Thread_Unblock( the_thread ); 688 } 685 686 switch ( the_thread_queue->sync_state ) { 687 case THREAD_QUEUE_NOTHING_HAPPENED: 688 /* 689 * All of this was dealt with above. This should never happen. 690 */ 691 break; 692 693 case THREAD_QUEUE_TIMEOUT: 694 the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; 695 _ISR_Enable( level ); 696 break; 697 698 case THREAD_QUEUE_SATISFIED: 699 if ( _Watchdog_Is_active( &the_thread->Timer ) ) { 700 _Watchdog_Deactivate( &the_thread->Timer ); 701 _ISR_Enable( level ); 702 (void) _Watchdog_Remove( &the_thread->Timer ); 703 } else 704 _ISR_Enable( level ); 705 break; 706 } 707 708 /* 709 * Global objects with thread queue's should not be operated on from an 710 * ISR. But the sync code still must allow short timeouts to be processed 711 * correctly. 712 */ 713 714 _Thread_Unblock( the_thread ); 715 689 716 if ( !_Objects_Is_local_id( the_thread->Object.id ) ) 690 717 _Thread_MP_Free_proxy( the_thread ); … … 722 749 Chain_Node *previous_node; 723 750 751 _ISR_Disable( level ); 724 752 for( index=0 ; 725 753 index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ; 726 754 index++ ) { 727 _ISR_Disable( level );728 755 if ( !_Chain_Is_empty( &the_thread_queue->Queues.Priority[ index ] ) ) { 729 756 the_thread = (Thread_Control *) … … 731 758 goto dequeue; 732 759 } 760 } 761 762 if ( the_thread_queue->sync ) { 763 the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; 733 764 _ISR_Enable( level ); 734 } 765 return _Thread_Executing; 766 } 767 768 _ISR_Enable( level ); 735 769 return NULL; 736 770
Note: See TracChangeset
for help on using the changeset viewer.