Changeset adbedd1 in rtems
- Timestamp:
- Apr 15, 2016, 7:18:26 PM (5 years ago)
- Branches:
- 5, master
- Children:
- f05eeb2
- Parents:
- 48b04fc3
- git-author:
- Sebastian Huber <sebastian.huber@…> (04/15/16 19:18:26)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (04/21/16 05:29:39)
- Location:
- cpukit
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/rtems/src/semdelete.c
r48b04fc3 radbedd1 93 93 _CORE_mutex_Flush( 94 94 &the_semaphore->Core_control.mutex, 95 CORE_MUTEX_WAS_DELETED,95 _CORE_mutex_Was_deleted, 96 96 _Semaphore_MP_Send_object_was_deleted, 97 97 id -
cpukit/rtems/src/semflush.c
r48b04fc3 radbedd1 54 54 _CORE_mutex_Flush( 55 55 &the_semaphore->Core_control.mutex, 56 CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT,56 _CORE_mutex_Unsatisfied_nowait, 57 57 _Semaphore_MP_Send_object_was_deleted, 58 58 id -
cpukit/score/include/rtems/score/corebarrierimpl.h
r48b04fc3 radbedd1 194 194 #endif 195 195 196 Thread_Control *_CORE_barrier_Was_deleted( 197 Thread_Control *the_thread, 198 Thread_queue_Queue *queue, 199 ISR_lock_Context *lock_context 200 ); 201 196 202 /* Must be a macro due to the multiprocessing dependent parameters */ 197 203 #define _CORE_barrier_Flush( \ … … 200 206 mp_id \ 201 207 ) \ 202 _Thread_queue_Flush( \ 203 &( the_barrier )->Wait_queue, \ 204 CORE_BARRIER_TQ_OPERATIONS, \ 205 CORE_BARRIER_WAS_DELETED, \ 206 mp_callout, \ 207 mp_id \ 208 ) 208 do { \ 209 ISR_lock_Context _core_barrier_flush_lock_context; \ 210 _Thread_queue_Acquire( \ 211 &( the_barrier )->Wait_queue, \ 212 &_core_barrier_flush_lock_context \ 213 ); \ 214 _Thread_queue_Flush_critical( \ 215 &( the_barrier )->Wait_queue.Queue, \ 216 CORE_BARRIER_TQ_OPERATIONS, \ 217 _CORE_barrier_Was_deleted, \ 218 mp_callout, \ 219 mp_id, \ 220 &_core_barrier_flush_lock_context \ 221 ); \ 222 } while ( 0 ) 209 223 210 224 /** -
cpukit/score/include/rtems/score/coremuteximpl.h
r48b04fc3 radbedd1 339 339 #endif 340 340 341 Thread_Control *_CORE_mutex_Was_deleted( 342 Thread_Control *the_thread, 343 Thread_queue_Queue *queue, 344 ISR_lock_Context *lock_context 345 ); 346 347 Thread_Control *_CORE_mutex_Unsatisfied_nowait( 348 Thread_Control *the_thread, 349 Thread_queue_Queue *queue, 350 ISR_lock_Context *lock_context 351 ); 352 341 353 /* Must be a macro due to the multiprocessing dependent parameters */ 342 354 #define _CORE_mutex_Flush( \ 343 355 the_mutex, \ 344 status, \356 filter, \ 345 357 mp_callout, \ 346 358 mp_id \ 347 359 ) \ 348 _Thread_queue_Flush( \ 349 &( the_mutex )->Wait_queue, \ 350 ( the_mutex )->operations, \ 351 status, \ 352 mp_callout, \ 353 mp_id \ 354 ) 360 do { \ 361 ISR_lock_Context _core_mutex_flush_lock_context; \ 362 _Thread_queue_Acquire( \ 363 &( the_mutex )->Wait_queue, \ 364 &_core_mutex_flush_lock_context \ 365 ); \ 366 _Thread_queue_Flush_critical( \ 367 &( the_mutex )->Wait_queue.Queue, \ 368 ( the_mutex )->operations, \ 369 filter, \ 370 mp_callout, \ 371 mp_id, \ 372 &_core_mutex_flush_lock_context \ 373 ); \ 374 } while ( 0 ) 355 375 356 376 /** -
cpukit/score/include/rtems/score/coresemimpl.h
r48b04fc3 radbedd1 87 87 ); 88 88 89 Thread_Control *_CORE_semaphore_Was_deleted( 90 Thread_Control *the_thread, 91 Thread_queue_Queue *queue, 92 ISR_lock_Context *lock_context 93 ); 94 95 Thread_Control *_CORE_semaphore_Unsatisfied_nowait( 96 Thread_Control *the_thread, 97 Thread_queue_Queue *queue, 98 ISR_lock_Context *lock_context 99 ); 100 89 101 #define _CORE_semaphore_Destroy( \ 90 102 the_semaphore, \ … … 93 105 ) \ 94 106 do { \ 95 _Thread_queue_Flush( \ 107 ISR_lock_Context _core_semaphore_destroy_lock_context; \ 108 _Thread_queue_Acquire( \ 96 109 &( the_semaphore )->Wait_queue, \ 110 &_core_semaphore_destroy_lock_context \ 111 ); \ 112 _Thread_queue_Flush_critical( \ 113 &( the_semaphore )->Wait_queue.Queue, \ 97 114 ( the_semaphore )->operations, \ 98 CORE_SEMAPHORE_WAS_DELETED, \115 _CORE_semaphore_Was_deleted, \ 99 116 mp_callout, \ 100 mp_id \ 117 mp_id, \ 118 &_core_semaphore_destroy_lock_context \ 101 119 ); \ 102 120 _Thread_queue_Destroy( &( the_semaphore )->Wait_queue ); \ … … 193 211 mp_id \ 194 212 ) \ 195 _Thread_queue_Flush( \ 196 &( the_semaphore )->Wait_queue, \ 197 ( the_semaphore )->operations, \ 198 CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT, \ 199 mp_callout, \ 200 mp_id \ 201 ) 213 do { \ 214 ISR_lock_Context _core_semaphore_flush_lock_context; \ 215 _Thread_queue_Acquire( \ 216 &( the_semaphore )->Wait_queue, \ 217 &_core_semaphore_flush_lock_context \ 218 ); \ 219 _Thread_queue_Flush_critical( \ 220 &( the_semaphore )->Wait_queue.Queue, \ 221 ( the_semaphore )->operations, \ 222 _CORE_semaphore_Unsatisfied_nowait, \ 223 mp_callout, \ 224 mp_id, \ 225 &_core_semaphore_flush_lock_context \ 226 ); \ 227 } while ( 0 ) 202 228 203 229 /** -
cpukit/score/include/rtems/score/threadqimpl.h
r48b04fc3 radbedd1 591 591 ); 592 592 593 void _Thread_queue_Do_flush( 594 Thread_queue_Control *the_thread_queue, 593 /** 594 * @brief Thread queue flush filter function. 595 * 596 * Called under protection of the thread queue lock by 597 * _Thread_queue_Flush_critical() to optionally alter the thread wait 598 * information and control the iteration. 599 * 600 * @param the_thread The thread to extract. This is the first parameter to 601 * optimize for architectures that use the same register for the first 602 * parameter and the return value. 603 * @param queue The actual thread queue. 604 * @param lock_context The lock context of the lock acquire. May be used to 605 * pass additional data to the filter function via an overlay structure. The 606 * filter function should not release or acquire the thread queue lock. 607 * 608 * @retval the_thread Extract this thread. 609 * @retval NULL Do not extract this thread and stop the thread queue flush 610 * operation. Threads that are already extracted will complete the flush 611 * operation. 612 */ 613 typedef Thread_Control *( *Thread_queue_Flush_filter )( 614 Thread_Control *the_thread, 615 Thread_queue_Queue *queue, 616 ISR_lock_Context *lock_context 617 ); 618 619 size_t _Thread_queue_Do_flush_critical( 620 Thread_queue_Queue *queue, 595 621 const Thread_queue_Operations *operations, 596 uint32_t status 597 #if defined(RTEMS_MULTIPROCESSING) 598 , 622 Thread_queue_Flush_filter filter, 623 #if defined(RTEMS_MULTIPROCESSING) 599 624 Thread_queue_MP_callout mp_callout, 600 Objects_Id mp_id 601 #endif 602 ); 603 604 /** 605 * @brief Unblocks all threads blocked on the thread queue. 606 * 607 * The thread timers of the threads are cancelled. 608 * 609 * @param the_thread_queue The thread queue. 625 Objects_Id mp_id, 626 #endif 627 ISR_lock_Context *lock_context 628 ); 629 630 /** 631 * @brief Unblocks all threads enqueued on the thread queue. 632 * 633 * This function iteratively extracts the first enqueued thread of the thread 634 * queue until the thread queue is empty or the filter function indicates a 635 * stop. The thread timers of the extracted threads are cancelled. The 636 * extracted threads are unblocked. 637 * 638 * @param queue The actual thread queue. 610 639 * @param operations The thread queue operations. 611 * @param status The return status for the threads. 640 * @param filter The filter functions is called for each thread to extract from 641 * the thread queue. It may be used to alter the thread under protection of 642 * the thread queue lock, for example to set the thread wait return code. 643 * The return value of the filter function controls if the thread queue flush 644 * operation should stop or continue. 612 645 * @param mp_callout Callout to extract the proxy of a remote thread. This 613 646 * parameter is only used on multiprocessing configurations. 614 647 * @param mp_id Object identifier of the object containing the thread queue. 615 648 * This parameter is only used on multiprocessing configurations. 616 */ 617 #if defined(RTEMS_MULTIPROCESSING) 618 #define _Thread_queue_Flush( \ 619 the_thread_queue, \ 649 * 650 * @return The count of extracted threads. 651 */ 652 #if defined(RTEMS_MULTIPROCESSING) 653 #define _Thread_queue_Flush_critical( \ 654 queue, \ 620 655 operations, \ 621 status, \ 622 mp_callout, \ 623 mp_id \ 624 ) \ 625 _Thread_queue_Do_flush( \ 626 the_thread_queue, \ 656 filter, \ 657 mp_callout, \ 658 mp_id, \ 659 lock_context \ 660 ) \ 661 _Thread_queue_Do_flush_critical( \ 662 queue, \ 627 663 operations, \ 628 status, \664 filter, \ 629 665 mp_callout, \ 630 mp_id \ 631 ) 632 #else 633 #define _Thread_queue_Flush( \ 634 the_thread_queue, \ 666 mp_id, \ 667 lock_context \ 668 ) 669 #else 670 #define _Thread_queue_Flush_critical( \ 671 queue, \ 635 672 operations, \ 636 status, \ 637 mp_callout, \ 638 mp_id \ 639 ) \ 640 _Thread_queue_Do_flush( \ 641 the_thread_queue, \ 673 filter, \ 674 mp_callout, \ 675 mp_id, \ 676 lock_context \ 677 ) \ 678 _Thread_queue_Do_flush_critical( \ 679 queue, \ 642 680 operations, \ 643 status \ 681 filter, \ 682 lock_context \ 644 683 ) 645 684 #endif -
cpukit/score/src/corebarrier.c
r48b04fc3 radbedd1 20 20 21 21 #include <rtems/score/corebarrierimpl.h> 22 #include <rtems/score/threadqimpl.h>23 22 24 23 void _CORE_barrier_Initialize( … … 33 32 _Thread_queue_Initialize( &the_barrier->Wait_queue ); 34 33 } 34 35 Thread_Control *_CORE_barrier_Was_deleted( 36 Thread_Control *the_thread, 37 Thread_queue_Queue *queue, 38 ISR_lock_Context *lock_context 39 ) 40 { 41 the_thread->Wait.return_code = CORE_BARRIER_WAS_DELETED; 42 43 return the_thread; 44 } -
cpukit/score/src/coremsgclose.c
r48b04fc3 radbedd1 22 22 #include <rtems/score/wkspace.h> 23 23 24 static Thread_Control *_CORE_message_queue_Was_deleted( 25 Thread_Control *the_thread, 26 Thread_queue_Queue *queue, 27 ISR_lock_Context *lock_context 28 ) 29 { 30 the_thread->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED; 31 32 return the_thread; 33 } 34 24 35 void _CORE_message_queue_Do_close( 25 36 CORE_message_queue_Control *the_message_queue … … 31 42 ) 32 43 { 44 ISR_lock_Context lock_context; 45 33 46 /* 34 47 * This will flush blocked threads whether they were blocked on … … 36 49 */ 37 50 38 _Thread_queue_Flush( 39 &the_message_queue->Wait_queue, 51 _CORE_message_queue_Acquire( the_message_queue, &lock_context ); 52 _Thread_queue_Flush_critical( 53 &the_message_queue->Wait_queue.Queue, 40 54 the_message_queue->operations, 41 CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,55 _CORE_message_queue_Was_deleted, 42 56 mp_callout, 43 mp_id 57 mp_id, 58 &lock_context 44 59 ); 45 60 -
cpukit/score/src/coremsgflush.c
r48b04fc3 radbedd1 42 42 * (1) The thread queue of pending senders is a logical extension 43 43 * of the pending message queue. In this case, it should be 44 * flushed using the _Thread_queue_Flush () service with a status44 * flushed using the _Thread_queue_Flush_critical() service with a status 45 45 * such as CORE_MESSAGE_QUEUE_SENDER_FLUSHED (which currently does 46 46 * not exist). This can be implemented without changing the "big-O" -
cpukit/score/src/coremutex.c
r48b04fc3 radbedd1 97 97 return CORE_MUTEX_STATUS_SUCCESSFUL; 98 98 } 99 100 Thread_Control *_CORE_mutex_Was_deleted( 101 Thread_Control *the_thread, 102 Thread_queue_Queue *queue, 103 ISR_lock_Context *lock_context 104 ) 105 { 106 the_thread->Wait.return_code = CORE_MUTEX_WAS_DELETED; 107 108 return the_thread; 109 } 110 111 Thread_Control *_CORE_mutex_Unsatisfied_nowait( 112 Thread_Control *the_thread, 113 Thread_queue_Queue *queue, 114 ISR_lock_Context *lock_context 115 ) 116 { 117 the_thread->Wait.return_code = CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT; 118 119 return the_thread; 120 } -
cpukit/score/src/coresem.c
r48b04fc3 radbedd1 37 37 } 38 38 } 39 40 Thread_Control *_CORE_semaphore_Was_deleted( 41 Thread_Control *the_thread, 42 Thread_queue_Queue *queue, 43 ISR_lock_Context *lock_context 44 ) 45 { 46 the_thread->Wait.return_code = CORE_SEMAPHORE_WAS_DELETED; 47 48 return the_thread; 49 } 50 51 Thread_Control *_CORE_semaphore_Unsatisfied_nowait( 52 Thread_Control *the_thread, 53 Thread_queue_Queue *queue, 54 ISR_lock_Context *lock_context 55 ) 56 { 57 the_thread->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT; 58 59 return the_thread; 60 } -
cpukit/score/src/threadqflush.c
r48b04fc3 radbedd1 19 19 #endif 20 20 21 #include <rtems/score/threadqimpl.h> 22 #include <rtems/score/objectimpl.h> 21 #include <rtems/score/threadimpl.h> 23 22 24 void _Thread_queue_Do_flush(25 Thread_queue_ Control *the_thread_queue,23 size_t _Thread_queue_Do_flush_critical( 24 Thread_queue_Queue *queue, 26 25 const Thread_queue_Operations *operations, 27 uint32_t status26 Thread_queue_Flush_filter filter, 28 27 #if defined(RTEMS_MULTIPROCESSING) 29 ,30 28 Thread_queue_MP_callout mp_callout, 31 Objects_Id mp_id 29 Objects_Id mp_id, 32 30 #endif 31 ISR_lock_Context *lock_context 33 32 ) 34 33 { 35 ISR_lock_Context lock_context; 36 Thread_Control *the_thread; 34 size_t flushed; 35 Chain_Control unblock; 36 Chain_Node *node; 37 Chain_Node *tail; 37 38 38 _Thread_queue_Acquire( the_thread_queue, &lock_context ); 39 flushed = 0; 40 _Chain_Initialize_empty( &unblock ); 39 41 40 while ( 41 ( 42 the_thread = _Thread_queue_First_locked( 43 the_thread_queue, 44 operations 45 ) 46 ) 47 ) { 48 the_thread->Wait.return_code = status; 42 while ( true ) { 43 Thread_queue_Heads *heads; 44 Thread_Control *first; 45 bool do_unblock; 49 46 50 _Thread_queue_Extract_critical( 51 &the_thread_queue->Queue, 47 heads = queue->heads; 48 if ( heads == NULL ) { 49 break; 50 } 51 52 first = ( *operations->first )( heads ); 53 first = ( *filter )( first, queue, lock_context ); 54 if ( first == NULL ) { 55 break; 56 } 57 58 do_unblock = _Thread_queue_Extract_locked( 59 queue, 52 60 operations, 53 the_thread,61 first, 54 62 mp_callout, 55 mp_id, 56 &lock_context 63 mp_id 57 64 ); 65 if ( do_unblock ) { 66 _Chain_Append_unprotected( &unblock, &first->Wait.Node.Chain ); 67 } 58 68 59 _Thread_queue_Acquire( the_thread_queue, &lock_context );69 ++flushed; 60 70 } 61 71 62 _Thread_queue_Release( the_thread_queue, &lock_context ); 72 node = _Chain_First( &unblock ); 73 tail = _Chain_Tail( &unblock ); 74 75 if ( node != tail ) { 76 Per_CPU_Control *cpu_self; 77 78 cpu_self = _Thread_Dispatch_disable_critical( lock_context ); 79 _Thread_queue_Queue_release( queue, lock_context ); 80 81 do { 82 Thread_Control *the_thread; 83 Chain_Node *next; 84 85 next = _Chain_Next( node ); 86 the_thread = THREAD_CHAIN_NODE_TO_THREAD( node ); 87 _Thread_Timer_remove( the_thread ); 88 _Thread_Unblock( the_thread ); 89 90 node = next; 91 } while ( node != tail ); 92 93 _Thread_Dispatch_enable( cpu_self ); 94 } else { 95 _Thread_queue_Queue_release( queue, lock_context ); 96 } 97 98 return flushed; 63 99 }
Note: See TracChangeset
for help on using the changeset viewer.