Changeset 07ff2c1 in rtems-libbsd
- Timestamp:
- 07/24/15 08:42:35 (8 years ago)
- Branches:
- 5, 5-freebsd-12, 6-freebsd-12, freebsd-9.3, master
- Children:
- 2fc413a
- Parents:
- 3cb5e9e
- Location:
- rtemsbsd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
rtemsbsd/include/machine/rtems-bsd-mutex.h
r3cb5e9e r07ff2c1 49 49 50 50 typedef struct { 51 Thread_queue_ Controlqueue;51 Thread_queue_Queue queue; 52 52 Thread_Control *owner; 53 53 int nest_level; -
rtemsbsd/include/machine/rtems-bsd-muteximpl.h
r3cb5e9e r07ff2c1 123 123 124 124 void rtems_bsd_mutex_unlock_more(rtems_bsd_mutex *m, Thread_Control *owner, 125 int keep_priority, RBTree_Node *first, ISR_lock_Context *lock_context); 125 int keep_priority, Thread_queue_Heads *heads, 126 ISR_lock_Context *lock_context); 126 127 127 128 static inline void … … 140 141 141 142 if (__predict_true(nest_level == 0)) { 142 RBTree_Node *first;143 Thread_queue_Heads *heads; 143 144 int keep_priority; 144 145 … … 152 153 _Atomic_Fence( ATOMIC_ORDER_ACQ_REL ); 153 154 154 first = _RBTree_First(&m->queue.Queues.Priority, RBT_LEFT);155 heads = m->queue.heads; 155 156 keep_priority = _Thread_Owns_resources(owner) 156 157 || !owner->priority_restore_hint; … … 158 159 m->owner = NULL; 159 160 160 if (__predict_true( first== NULL && keep_priority)) {161 if (__predict_true(heads == NULL && keep_priority)) { 161 162 _Thread_queue_Release(&m->queue, &lock_context); 162 163 } else { 163 164 rtems_bsd_mutex_unlock_more(m, owner, keep_priority, 164 first, &lock_context);165 heads, &lock_context); 165 166 } 166 167 … … 189 190 rtems_bsd_mutex_destroy(struct lock_object *lock, rtems_bsd_mutex *m) 190 191 { 191 BSD_ASSERT( _RBTree_Is_empty(&m->queue.Queues.Priority));192 BSD_ASSERT(m->queue.heads == NULL); 192 193 193 194 if (rtems_bsd_mutex_owned(m)) { -
rtemsbsd/rtems/rtems-bsd-muteximpl.c
r3cb5e9e r07ff2c1 44 44 #include <rtems/score/threadqimpl.h> 45 45 46 #define BSD_MUTEX_TQ_OPERATIONS &_Thread_queue_Operations_priority 47 46 48 void 47 49 rtems_bsd_mutex_lock_more(struct lock_object *lock, rtems_bsd_mutex *m, … … 59 61 60 62 ++executing->resource_count; 61 _Thread_queue_Enqueue_critical(&m->queue, executing, 63 _Thread_queue_Enqueue_critical(&m->queue, 64 BSD_MUTEX_TQ_OPERATIONS, executing, 62 65 STATES_WAITING_FOR_MUTEX, WATCHDOG_NO_TIMEOUT, 0, 63 66 lock_context); … … 67 70 void 68 71 rtems_bsd_mutex_unlock_more(rtems_bsd_mutex *m, Thread_Control *owner, 69 int keep_priority, RBTree_Node *first, ISR_lock_Context *lock_context) 72 int keep_priority, Thread_queue_Heads *heads, 73 ISR_lock_Context *lock_context) 70 74 { 71 if (first != NULL) { 75 if (heads != NULL) { 76 const Thread_queue_Operations *operations; 72 77 Thread_Control *new_owner; 73 78 74 new_owner = THREAD_RBTREE_NODE_TO_THREAD(first); 79 operations = BSD_MUTEX_TQ_OPERATIONS; 80 new_owner = ( *operations->first )( heads ); 75 81 m->owner = new_owner; 76 _Thread_queue_Extract_critical(&m->queue, new_owner,77 lock_context);82 _Thread_queue_Extract_critical(&m->queue, operations, 83 new_owner, lock_context); 78 84 } else { 79 85 _Thread_queue_Release(&m->queue, lock_context);
Note: See TracChangeset
for help on using the changeset viewer.