Changeset 07ff2c1 in rtems-libbsd


Ignore:
Timestamp:
07/24/15 08:42:35 (8 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, 5-freebsd-12, 6-freebsd-12, freebsd-9.3, master
Children:
2fc413a
Parents:
3cb5e9e
Message:

rtems-bsd-mutex: Update due to API changes

Location:
rtemsbsd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • rtemsbsd/include/machine/rtems-bsd-mutex.h

    r3cb5e9e r07ff2c1  
    4949
    5050typedef struct {
    51         Thread_queue_Control queue;
     51        Thread_queue_Queue queue;
    5252        Thread_Control *owner;
    5353        int nest_level;
  • rtemsbsd/include/machine/rtems-bsd-muteximpl.h

    r3cb5e9e r07ff2c1  
    123123
    124124void 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);
    126127
    127128static inline void
     
    140141
    141142        if (__predict_true(nest_level == 0)) {
    142                 RBTree_Node *first;
     143                Thread_queue_Heads *heads;
    143144                int keep_priority;
    144145
     
    152153                _Atomic_Fence( ATOMIC_ORDER_ACQ_REL );
    153154
    154                 first = _RBTree_First(&m->queue.Queues.Priority, RBT_LEFT);
     155                heads = m->queue.heads;
    155156                keep_priority = _Thread_Owns_resources(owner)
    156157                    || !owner->priority_restore_hint;
     
    158159                m->owner = NULL;
    159160
    160                 if (__predict_true(first == NULL && keep_priority)) {
     161                if (__predict_true(heads == NULL && keep_priority)) {
    161162                        _Thread_queue_Release(&m->queue, &lock_context);
    162163                } else {
    163164                        rtems_bsd_mutex_unlock_more(m, owner, keep_priority,
    164                             first, &lock_context);
     165                            heads, &lock_context);
    165166                }
    166167
     
    189190rtems_bsd_mutex_destroy(struct lock_object *lock, rtems_bsd_mutex *m)
    190191{
    191         BSD_ASSERT(_RBTree_Is_empty(&m->queue.Queues.Priority));
     192        BSD_ASSERT(m->queue.heads == NULL);
    192193
    193194        if (rtems_bsd_mutex_owned(m)) {
  • rtemsbsd/rtems/rtems-bsd-muteximpl.c

    r3cb5e9e r07ff2c1  
    4444#include <rtems/score/threadqimpl.h>
    4545
     46#define BSD_MUTEX_TQ_OPERATIONS &_Thread_queue_Operations_priority
     47
    4648void
    4749rtems_bsd_mutex_lock_more(struct lock_object *lock, rtems_bsd_mutex *m,
     
    5961
    6062                ++executing->resource_count;
    61                 _Thread_queue_Enqueue_critical(&m->queue, executing,
     63                _Thread_queue_Enqueue_critical(&m->queue,
     64                    BSD_MUTEX_TQ_OPERATIONS, executing,
    6265                    STATES_WAITING_FOR_MUTEX, WATCHDOG_NO_TIMEOUT, 0,
    6366                    lock_context);
     
    6770void
    6871rtems_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)
    7074{
    71         if (first != NULL) {
     75        if (heads != NULL) {
     76                const Thread_queue_Operations *operations;
    7277                Thread_Control *new_owner;
    7378
    74                 new_owner = THREAD_RBTREE_NODE_TO_THREAD(first);
     79                operations = BSD_MUTEX_TQ_OPERATIONS;
     80                new_owner = ( *operations->first )( heads );
    7581                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);
    7884        } else {
    7985                _Thread_queue_Release(&m->queue, lock_context);
Note: See TracChangeset for help on using the changeset viewer.