Added recursive_lock_transfer_lock() to the fs_shell.

This commit is contained in:
Axel Dörfler 2012-03-30 22:04:34 +02:00
parent 225e1b1190
commit 1674a53a45
3 changed files with 14 additions and 1 deletions

View File

@ -1013,6 +1013,7 @@
#define recursive_lock_trylock fssh_recursive_lock_trylock
#define recursive_lock_unlock fssh_recursive_lock_unlock
#define recursive_lock_get_recursion fssh_recursive_lock_get_recursion
#define recursive_lock_transfer_lock fssh_recursive_lock_transfer_lock
#define rw_lock_init fssh_rw_lock_init
#define rw_lock_init_etc fssh_rw_lock_init_etc

View File

@ -61,6 +61,7 @@ extern fssh_status_t fssh_recursive_lock_lock(fssh_recursive_lock *lock);
extern fssh_status_t fssh_recursive_lock_trylock(fssh_recursive_lock *lock);
extern void fssh_recursive_lock_unlock(fssh_recursive_lock *lock);
extern int32_t fssh_recursive_lock_get_recursion(fssh_recursive_lock *lock);
extern void fssh_recursive_lock_transfer_lock(fssh_recursive_lock *lock, fssh_thread_id thread);
extern void fssh_rw_lock_init(fssh_rw_lock* lock, const char* name);
// name is *not* cloned nor freed in rw_lock_destroy()

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2002-2012, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@ -102,6 +102,17 @@ fssh_recursive_lock_unlock(fssh_recursive_lock *lock)
}
extern "C" void
fssh_recursive_lock_transfer_lock(fssh_recursive_lock *lock,
fssh_thread_id thread)
{
if (lock->recursion != 1)
fssh_panic("invalid recursion level for lock transfer!");
lock->holder = thread;
}
// #pragma mark -