Changeset e01f6e0 in rtems-libbsd


Ignore:
Timestamp:
Sep 22, 2014, 2:49:18 PM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, 5-freebsd-12, 6-freebsd-12, freebsd-9.3, master
Children:
9a937f4
Parents:
dce8247
git-author:
Sebastian Huber <sebastian.huber@…> (09/22/14 14:49:18)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/22/14 14:50:44)
Message:

CONDVAR(9): Use lock class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtemsbsd/rtems/rtems-bsd-condvar.c

    rdce8247 re01f6e0  
    88
    99/*
    10  * Copyright (c) 2009-2013 embedded brains GmbH. All rights reserved.
     10 * Copyright (c) 2009-2014 embedded brains GmbH. All rights reserved.
    1111 *
    1212 *  Dornierstr. 4
    13  *  Obere Lagerstr. 30
    1413 *  82178 Puchheim
    1514 *  Germany
     
    7978static int _cv_wait_support(struct cv *cv, struct lock_object *lock, int timo, bool relock)
    8079{
    81         rtems_status_code sc = RTEMS_SUCCESSFUL;
    8280        int eno = 0;
    8381        Objects_Locations location = OBJECTS_ERROR;
     
    8583
    8684        if (location == OBJECTS_LOCAL) {
     85                struct lock_class *class = LOCK_CLASS(lock);
     86                int lock_state;
     87
    8788                if (pcv->Mutex != POSIX_CONDITION_VARIABLES_NO_MUTEX && pcv->Mutex != lock->lo_id) {
    8889                        _Thread_Enable_dispatch();
     
    9394                }
    9495
    95                 sc = rtems_semaphore_release(lock->lo_id);
    96                 if (sc != RTEMS_SUCCESSFUL) {
    97                         _Thread_Enable_dispatch();
    98 
    99                         BSD_ASSERT(false);
    100 
    101                         return EINVAL;
    102                 }
     96                lock_state = (*class->lc_unlock)(lock);
    10397
    10498                pcv->Mutex = lock->lo_id;
     
    130124
    131125                if (relock) {
    132                         sc = rtems_semaphore_obtain(lock->lo_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    133                         if (sc != RTEMS_SUCCESSFUL) {
    134                                 BSD_ASSERT(false);
    135 
    136                                 eno = EINVAL;
    137                         }
     126                        (*class->lc_lock)(lock, lock_state);
    138127                }
    139128
     
    188177{
    189178  /* XXX */
    190         _cv_wait_support(cvp, lock, 0, true);
     179        return _cv_wait_support(cvp, lock, 0, true);
    191180}
    192181
Note: See TracChangeset for help on using the changeset viewer.