diff --git a/src/apps/installer/CopyEngine.cpp b/src/apps/installer/CopyEngine.cpp index a3a014dbbb..db412e6bd3 100644 --- a/src/apps/installer/CopyEngine.cpp +++ b/src/apps/installer/CopyEngine.cpp @@ -19,46 +19,14 @@ #include #include -#include "AutoLocker.h" #include "InstallerWindow.h" // TODO: For PACKAGES_DIRECTORY and VAR_DIRECTORY, not so nice... +#include "SemaphoreLocker.h" + using std::nothrow; -// SemaphoreLocking -class SemaphoreLocking { -public: - inline bool Lock(sem_id* lockable) - { - return acquire_sem(*lockable) == B_OK; - } - - inline void Unlock(sem_id* lockable) - { - release_sem(*lockable); - } -}; - -// SemaphoreLocker -class SemaphoreLocker : public AutoLocker { -public: - inline SemaphoreLocker(sem_id semaphore, bool alreadyLocked = false, - bool lockIfNotLocked = true) - : - AutoLocker(), - fSem(semaphore) - { - SetTo(&fSem, alreadyLocked, lockIfNotLocked); - } - -private: - sem_id fSem; -}; - - - - CopyEngine::CopyEngine(const BMessenger& messenger, BMessage* message) : fBufferQueue(), diff --git a/src/apps/installer/CopyEngine.h b/src/apps/installer/CopyEngine.h index 887b2b0a74..bda85ad7a4 100644 --- a/src/apps/installer/CopyEngine.h +++ b/src/apps/installer/CopyEngine.h @@ -18,6 +18,7 @@ class BFile; class BMessage; class BMessenger; + class CopyEngine { public: CopyEngine(const BMessenger& messenger, @@ -109,4 +110,4 @@ private: }; -#endif // COPY_ENGINE_2_H +#endif // COPY_ENGINE_H diff --git a/src/apps/installer/SemaphoreLocker.h b/src/apps/installer/SemaphoreLocker.h new file mode 100644 index 0000000000..a88a9feb30 --- /dev/null +++ b/src/apps/installer/SemaphoreLocker.h @@ -0,0 +1,41 @@ +/* + * Copyright 2008-2009, Stephan Aßmus + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef _SEMAPHORE_LOCKER_H +#define _SEMAPHORE_LOCKER_H + + +#include "AutoLocker.h" + + +class SemaphoreLocking { +public: + inline bool Lock(sem_id* lockable) + { + return acquire_sem(*lockable) == B_OK; + } + + inline void Unlock(sem_id* lockable) + { + release_sem(*lockable); + } +}; + + +class SemaphoreLocker : public AutoLocker { +public: + inline SemaphoreLocker(sem_id semaphore, bool alreadyLocked = false, + bool lockIfNotLocked = true) + : + AutoLocker(), + fSem(semaphore) + { + SetTo(&fSem, alreadyLocked, lockIfNotLocked); + } + +private: + sem_id fSem; +}; + +#endif // _SEMAPHORE_LOCKER_H