Changeset 691ed15 in rtems-libbsd


Ignore:
Timestamp:
Aug 11, 2016, 7:01:42 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5-freebsd-12, freebsd-9.3, master
Children:
c83cf5c
Parents:
26a8cee
git-author:
Sebastian Huber <sebastian.huber@…> (08/11/16 07:01:42)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/11/16 10:37:16)
Message:

rtems-bsd-mutex: Use _Thread_queue_Surrender()

Location:
rtemsbsd
Files:
2 edited

Legend:

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

    r26a8cee r691ed15  
    4949
    5050#include <rtems/score/threadimpl.h>
     51#include <rtems/score/threadqimpl.h>
    5152
    5253#ifdef __cplusplus
    5354extern "C" {
    5455#endif /* __cplusplus */
     56
     57#define RTEMS_BSD_MUTEX_TQ_OPERATIONS \
     58    &_Thread_queue_Operations_priority_inherit
    5559
    5660static inline void
     
    123127}
    124128
    125 void rtems_bsd_mutex_unlock_more(rtems_bsd_mutex *m, Thread_Control *owner,
    126     int keep_priority, Thread_queue_Heads *heads,
    127     Thread_queue_Context *queue_context);
    128 
    129129static inline void
    130130rtems_bsd_mutex_unlock(rtems_bsd_mutex *m)
     
    164164                        _Thread_queue_Release(&m->queue, &queue_context.Lock_context);
    165165                } else {
    166                         rtems_bsd_mutex_unlock_more(m, owner, keep_priority,
    167                             heads, &queue_context);
     166                        _Thread_queue_Surrender(&m->queue.Queue,
     167                            RTEMS_BSD_MUTEX_TQ_OPERATIONS, heads, owner,
     168                            keep_priority, &queue_context);
    168169                }
    169170
  • rtemsbsd/rtems/rtems-kernel-muteximpl.c

    r26a8cee r691ed15  
    4242
    4343#include <rtems/score/schedulerimpl.h>
    44 #include <rtems/score/threadqimpl.h>
    45 
    46 #define BSD_MUTEX_TQ_OPERATIONS &_Thread_queue_Operations_priority_inherit
    4744
    4845void
     
    5754                _Thread_queue_Release(&m->queue, &queue_context->Lock_context);
    5855        } else {
    59                 ++executing->resource_count;
    6056                _Thread_queue_Context_set_expected_level(queue_context, 1);
    6157                _Thread_queue_Context_set_no_timeout(queue_context);
     
    6359                    _Thread_queue_Deadlock_fatal);
    6460                _Thread_queue_Enqueue_critical(&m->queue.Queue,
    65                     BSD_MUTEX_TQ_OPERATIONS, executing,
     61                    RTEMS_BSD_MUTEX_TQ_OPERATIONS, executing,
    6662                    STATES_WAITING_FOR_SYS_LOCK_MUTEX, queue_context);
    6763        }
    6864}
    69 
    70 void
    71 rtems_bsd_mutex_unlock_more(rtems_bsd_mutex *m, Thread_Control *owner,
    72     int keep_priority, Thread_queue_Heads *heads,
    73     Thread_queue_Context *queue_context)
    74 {
    75         if (heads != NULL) {
    76                 const Thread_queue_Operations *operations;
    77                 Thread_Control *new_owner;
    78 
    79                 operations = BSD_MUTEX_TQ_OPERATIONS;
    80                 new_owner = ( *operations->first )( heads );
    81                 m->queue.Queue.owner = new_owner;
    82                 _Thread_queue_Extract_critical(&m->queue.Queue, operations,
    83                     new_owner, queue_context);
    84         } else {
    85                 _Thread_queue_Release(&m->queue, &queue_context->Lock_context);
    86         }
    87 
    88         if (!keep_priority) {
    89                 Per_CPU_Control *cpu_self;
    90 
    91                 cpu_self = _Thread_Dispatch_disable();
    92                 _Thread_Restore_priority(owner);
    93                 _Thread_Dispatch_enable(cpu_self);
    94         }
    95 }
Note: See TracChangeset for help on using the changeset viewer.