From 1674a53a45f12befa208e7478337d811d1fed6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 30 Mar 2012 22:04:34 +0200 Subject: [PATCH] Added recursive_lock_transfer_lock() to the fs_shell. --- headers/private/fs_shell/fssh_api_wrapper.h | 1 + headers/private/fs_shell/fssh_lock.h | 1 + src/tools/fs_shell/lock.cpp | 13 ++++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/headers/private/fs_shell/fssh_api_wrapper.h b/headers/private/fs_shell/fssh_api_wrapper.h index 18fb61bc4b..edb40a9458 100644 --- a/headers/private/fs_shell/fssh_api_wrapper.h +++ b/headers/private/fs_shell/fssh_api_wrapper.h @@ -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 diff --git a/headers/private/fs_shell/fssh_lock.h b/headers/private/fs_shell/fssh_lock.h index 8be96a183a..23f246b8e8 100644 --- a/headers/private/fs_shell/fssh_lock.h +++ b/headers/private/fs_shell/fssh_lock.h @@ -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() diff --git a/src/tools/fs_shell/lock.cpp b/src/tools/fs_shell/lock.cpp index 8b8ae72bd0..5008c77a21 100644 --- a/src/tools/fs_shell/lock.cpp +++ b/src/tools/fs_shell/lock.cpp @@ -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 -