Changeset 1c61fdb in rtems-libbsd


Ignore:
Timestamp:
Oct 31, 2013, 8:35:25 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, afaeccc05a556f6aa25ba044a7e49d6aa634a59e, freebsd-9.3, master
Children:
8671119
Parents:
45d74f2
git-author:
Sebastian Huber <sebastian.huber@…> (10/31/13 08:35:25)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/31/13 12:18:54)
Message:

MUTEX(9): Allow destruction of self-owned mutexes

File:
1 edited

Legend:

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

    r45d74f2 r1c61fdb  
    300300mtx_destroy(struct mtx *m)
    301301{
    302         rtems_status_code sc = RTEMS_SUCCESSFUL;
    303 
    304         sc = rtems_semaphore_delete(m->lock_object.lo_id);
    305         BSD_ASSERT_SC(sc);
     302        rtems_status_code sc;
     303
     304        do {
     305                sc = rtems_semaphore_delete(m->lock_object.lo_id);
     306                if (sc == RTEMS_RESOURCE_IN_USE) {
     307                        BSD_ASSERT(mtx_owned(m));
     308
     309                        mtx_unlock(m);
     310                } else {
     311                        BSD_ASSERT_SC(sc);
     312                }
     313        } while (sc != RTEMS_SUCCESSFUL);
    306314
    307315        rtems_chain_extract(&m->lock_object.lo_node);
    308316
    309   m->lock_object.lo_id = 0;
    310   m->lock_object.lo_flags &= ~LO_INITIALIZED;
     317        m->lock_object.lo_id = 0;
     318        m->lock_object.lo_flags &= ~LO_INITIALIZED;
    311319}
    312320
Note: See TracChangeset for help on using the changeset viewer.