summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-25 13:09:58 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-25 13:09:58 +0200
commit9546d905c263d7a0ed25266e7dc00da740105b29 (patch)
tree13e5b97a6dfe7f6c83eb12e849d0798d5aa8abeb
parentrc.conf: Add the net directives by default. (diff)
downloadrtems-libbsd-9546d905c263d7a0ed25266e7dc00da740105b29.tar.bz2
rtems-bsd-mutex: Update due to API changes
-rw-r--r--rtemsbsd/include/machine/rtems-bsd-muteximpl.h31
-rw-r--r--rtemsbsd/rtems/rtems-kernel-muteximpl.c12
2 files changed, 23 insertions, 20 deletions
diff --git a/rtemsbsd/include/machine/rtems-bsd-muteximpl.h b/rtemsbsd/include/machine/rtems-bsd-muteximpl.h
index bbf06377..0ae0ea78 100644
--- a/rtemsbsd/include/machine/rtems-bsd-muteximpl.h
+++ b/rtemsbsd/include/machine/rtems-bsd-muteximpl.h
@@ -66,16 +66,17 @@ rtems_bsd_mutex_init(struct lock_object *lock, rtems_bsd_mutex *m,
void rtems_bsd_mutex_lock_more(struct lock_object *lock, rtems_bsd_mutex *m,
Thread_Control *owner, Thread_Control *executing,
- ISR_lock_Context *lock_context);
+ Thread_queue_Context *queue_context);
static inline void
rtems_bsd_mutex_lock(struct lock_object *lock, rtems_bsd_mutex *m)
{
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
Thread_Control *executing;
Thread_Control *owner;
- _Thread_queue_Acquire(&m->queue, &lock_context);
+ _Thread_queue_Context_initialize(&queue_context, NULL);
+ _Thread_queue_Acquire(&m->queue, &queue_context.Lock_context);
owner = m->owner;
executing = _Thread_Executing;
@@ -84,10 +85,10 @@ rtems_bsd_mutex_lock(struct lock_object *lock, rtems_bsd_mutex *m)
m->owner = executing;
++executing->resource_count;
- _Thread_queue_Release(&m->queue, &lock_context);
+ _Thread_queue_Release(&m->queue, &queue_context.Lock_context);
} else {
rtems_bsd_mutex_lock_more(lock, m, owner, executing,
- &lock_context);
+ &queue_context);
}
}
@@ -95,11 +96,12 @@ static inline int
rtems_bsd_mutex_trylock(struct lock_object *lock, rtems_bsd_mutex *m)
{
int success;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
Thread_Control *executing;
Thread_Control *owner;
- _Thread_queue_Acquire(&m->queue, &lock_context);
+ _Thread_queue_Context_initialize(&queue_context, NULL);
+ _Thread_queue_Acquire(&m->queue, &queue_context.Lock_context);
owner = m->owner;
executing = _Thread_Executing;
@@ -116,23 +118,24 @@ rtems_bsd_mutex_trylock(struct lock_object *lock, rtems_bsd_mutex *m)
success = 0;
}
- _Thread_queue_Release(&m->queue, &lock_context);
+ _Thread_queue_Release(&m->queue, &queue_context.Lock_context);
return (success);
}
void rtems_bsd_mutex_unlock_more(rtems_bsd_mutex *m, Thread_Control *owner,
int keep_priority, Thread_queue_Heads *heads,
- ISR_lock_Context *lock_context);
+ Thread_queue_Context *queue_context);
static inline void
rtems_bsd_mutex_unlock(rtems_bsd_mutex *m)
{
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
Thread_Control *owner;
int nest_level;
- _Thread_queue_Acquire(&m->queue, &lock_context);
+ _Thread_queue_Context_initialize(&queue_context, NULL);
+ _Thread_queue_Acquire(&m->queue, &queue_context.Lock_context);
nest_level = m->nest_level;
owner = m->owner;
@@ -159,16 +162,16 @@ rtems_bsd_mutex_unlock(rtems_bsd_mutex *m)
m->owner = NULL;
if (__predict_true(heads == NULL && keep_priority)) {
- _Thread_queue_Release(&m->queue, &lock_context);
+ _Thread_queue_Release(&m->queue, &queue_context.Lock_context);
} else {
rtems_bsd_mutex_unlock_more(m, owner, keep_priority,
- heads, &lock_context);
+ heads, &queue_context);
}
} else {
m->nest_level = nest_level - 1;
- _Thread_queue_Release(&m->queue, &lock_context);
+ _Thread_queue_Release(&m->queue, &queue_context.Lock_context);
}
}
diff --git a/rtemsbsd/rtems/rtems-kernel-muteximpl.c b/rtemsbsd/rtems/rtems-kernel-muteximpl.c
index ff54365e..455b089f 100644
--- a/rtemsbsd/rtems/rtems-kernel-muteximpl.c
+++ b/rtemsbsd/rtems/rtems-kernel-muteximpl.c
@@ -48,13 +48,13 @@
void
rtems_bsd_mutex_lock_more(struct lock_object *lock, rtems_bsd_mutex *m,
Thread_Control *owner, Thread_Control *executing,
- ISR_lock_Context *lock_context)
+ Thread_queue_Context *queue_context)
{
if (owner == executing) {
BSD_ASSERT(lock->lo_flags & LO_RECURSABLE);
++m->nest_level;
- _Thread_queue_Release(&m->queue, lock_context);
+ _Thread_queue_Release(&m->queue, &queue_context->Lock_context);
} else {
/* Priority inheritance */
_Thread_Raise_priority(owner, executing->current_priority);
@@ -63,14 +63,14 @@ rtems_bsd_mutex_lock_more(struct lock_object *lock, rtems_bsd_mutex *m,
_Thread_queue_Enqueue_critical(&m->queue,
BSD_MUTEX_TQ_OPERATIONS, executing,
STATES_WAITING_FOR_MUTEX, WATCHDOG_NO_TIMEOUT, 0,
- lock_context);
+ &queue_context->Lock_context);
}
}
void
rtems_bsd_mutex_unlock_more(rtems_bsd_mutex *m, Thread_Control *owner,
int keep_priority, Thread_queue_Heads *heads,
- ISR_lock_Context *lock_context)
+ Thread_queue_Context *queue_context)
{
if (heads != NULL) {
const Thread_queue_Operations *operations;
@@ -80,9 +80,9 @@ rtems_bsd_mutex_unlock_more(rtems_bsd_mutex *m, Thread_Control *owner,
new_owner = ( *operations->first )( heads );
m->owner = new_owner;
_Thread_queue_Extract_critical(&m->queue, operations,
- new_owner, NULL, 0, lock_context);
+ new_owner, queue_context);
} else {
- _Thread_queue_Release(&m->queue, lock_context);
+ _Thread_queue_Release(&m->queue, &queue_context->Lock_context);
}
if (!keep_priority) {