diff --git a/src/add-ons/kernel/file_systems/bfs/Lock.h b/src/add-ons/kernel/file_systems/bfs/Lock.h index 220be5420b..a0c289f7a3 100644 --- a/src/add-ons/kernel/file_systems/bfs/Lock.h +++ b/src/add-ons/kernel/file_systems/bfs/Lock.h @@ -149,15 +149,17 @@ class Locker { #ifdef FAST_LOCK class ReadWriteLock { public: - ReadWriteLock(const char *name = "bfs r/w lock") + ReadWriteLock(const char *name) + : + fWriteLock() + { + Initialize(name); + } + + ReadWriteLock() : - fSemaphore(create_sem(0, name)), - fCount(MAX_READERS), fWriteLock() { -#ifndef USER - set_sem_owner(fSemaphore, B_SYSTEM_TEAM); -#endif } ~ReadWriteLock() @@ -165,6 +167,16 @@ class ReadWriteLock { delete_sem(fSemaphore); } + status_t Initialize(const char *name = "bfs r/w lock") + { + fSemaphore = create_sem(0, name); + fCount = MAX_READERS; +#ifndef USER + set_sem_owner(fSemaphore, B_SYSTEM_TEAM); +#endif + return fSemaphore; + } + status_t InitCheck() { if (fSemaphore < B_OK) @@ -226,13 +238,13 @@ class ReadWriteLock { #else // FAST_LOCK class ReadWriteLock { public: - ReadWriteLock(const char *name = "bfs r/w lock") - : - fSemaphore(create_sem(MAX_READERS, name)) + ReadWriteLock(const char *name) + { + Initialize(name); + } + + ReadWriteLock() { -#ifndef USER - set_sem_owner(fSemaphore, B_SYSTEM_TEAM); -#endif } ~ReadWriteLock() @@ -240,6 +252,15 @@ class ReadWriteLock { delete_sem(fSemaphore); } + status_t Initialize(const char *name = "bfs r/w lock") + { + fSemaphore = create_sem(MAX_READERS, name); +#ifndef USER + set_sem_owner(fSemaphore, B_SYSTEM_TEAM); +#endif + return fSemaphore; + } + status_t InitCheck() { if (fSemaphore < B_OK)