Changeset bf7faad in rtems-libbsd


Ignore:
Timestamp:
Jun 28, 2016, 6:32:30 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
c1e05b9ea378b2971e3d7704779112b4bc4296da, freebsd-9.3, e6acc15bc94ea35f40e50b42692584c456ba9722
Children:
b5db332
Parents:
b6c170f
git-author:
Sebastian Huber <sebastian.huber@…> (06/28/16 06:32:30)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/28/16 06:07:14)
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

    rb6c170f rbf7faad  
    88
    99/*
    10  * Copyright (c) 2014, 2015 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2014, 2016 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
     
    4949
    5050typedef struct {
    51         Thread_queue_Queue queue;
    52         Thread_Control *owner;
     51        Thread_queue_Control queue;
    5352        int nest_level;
    5453} rtems_bsd_mutex;
  • rtemsbsd/include/machine/rtems-bsd-muteximpl.h

    rb6c170f rbf7faad  
    99
    1010/*
    11  * Copyright (c) 2014, 2015 embedded brains GmbH.  All rights reserved.
     11 * Copyright (c) 2014, 2016 embedded brains GmbH.  All rights reserved.
    1212 *
    1313 *  embedded brains GmbH
     
    5959{
    6060        _Thread_queue_Initialize(&m->queue);
    61         m->owner = NULL;
    6261        m->nest_level = 0;
    6362
     
    7978        _Thread_queue_Acquire(&m->queue, &queue_context.Lock_context);
    8079
    81         owner = m->owner;
     80        owner = m->queue.Queue.owner;
    8281        executing = _Thread_Executing;
    8382
    8483        if (__predict_true(owner == NULL)) {
    85                 m->owner = executing;
     84                m->queue.Queue.owner = executing;
    8685                ++executing->resource_count;
    8786
     
    104103        _Thread_queue_Acquire(&m->queue, &queue_context.Lock_context);
    105104
    106         owner = m->owner;
     105        owner = m->queue.Queue.owner;
    107106        executing = _Thread_Executing;
    108107
    109108        if (owner == NULL) {
    110                 m->owner = executing;
     109                m->queue.Queue.owner = executing;
    111110                ++executing->resource_count;
    112111                success = 1;
     
    139138
    140139        nest_level = m->nest_level;
    141         owner = m->owner;
     140        owner = m->queue.Queue.owner;
    142141
    143142        BSD_ASSERT(owner == _Thread_Executing);
     
    156155                _Atomic_Fence( ATOMIC_ORDER_ACQ_REL );
    157156
    158                 heads = m->queue.heads;
     157                heads = m->queue.Queue.heads;
    159158                keep_priority = _Thread_Owns_resources(owner)
    160159                    || !owner->priority_restore_hint;
    161160
    162                 m->owner = NULL;
     161                m->queue.Queue.owner = NULL;
    163162
    164163                if (__predict_true(heads == NULL && keep_priority)) {
     
    180179{
    181180
    182         return (m->owner == _Thread_Get_executing());
     181        return (m->queue.Queue.owner == _Thread_Get_executing());
    183182}
    184183
     
    193192rtems_bsd_mutex_destroy(struct lock_object *lock, rtems_bsd_mutex *m)
    194193{
    195         BSD_ASSERT(m->queue.heads == NULL);
     194        BSD_ASSERT(m->queue.Queue.heads == NULL);
    196195
    197196        if (rtems_bsd_mutex_owned(m)) {
  • rtemsbsd/rtems/rtems-kernel-muteximpl.c

    rb6c170f rbf7faad  
    88
    99/*
    10  * Copyright (c) 2014, 2015 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2014, 2016 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
     
    4444#include <rtems/score/threadqimpl.h>
    4545
    46 #define BSD_MUTEX_TQ_OPERATIONS &_Thread_queue_Operations_priority
     46#define BSD_MUTEX_TQ_OPERATIONS &_Thread_queue_Operations_priority_inherit
    4747
    4848void
     
    5757                _Thread_queue_Release(&m->queue, &queue_context->Lock_context);
    5858        } else {
    59                 /* Priority inheritance */
    60                 _Thread_Raise_priority(owner, executing->current_priority);
    61 
    6259                ++executing->resource_count;
    6360                _Thread_queue_Context_set_expected_level(queue_context, 1);
    6461                _Thread_queue_Context_set_no_timeout(queue_context);
    65                 _Thread_queue_Enqueue_critical(&m->queue,
     62                _Thread_queue_Context_set_deadlock_callout(queue_context,
     63                    _Thread_queue_Deadlock_fatal);
     64                _Thread_queue_Enqueue_critical(&m->queue.Queue,
    6665                    BSD_MUTEX_TQ_OPERATIONS, executing,
    67                     STATES_WAITING_FOR_MUTEX, queue_context);
     66                    STATES_WAITING_FOR_SYS_LOCK_MUTEX, queue_context);
    6867        }
    6968}
     
    8079                operations = BSD_MUTEX_TQ_OPERATIONS;
    8180                new_owner = ( *operations->first )( heads );
    82                 m->owner = new_owner;
    83                 _Thread_queue_Extract_critical(&m->queue, operations,
     81                m->queue.Queue.owner = new_owner;
     82                _Thread_queue_Extract_critical(&m->queue.Queue, operations,
    8483                    new_owner, queue_context);
    8584        } else {
Note: See TracChangeset for help on using the changeset viewer.