< prev index next >

src/share/vm/utilities/semaphore.hpp

Print this page

        

*** 26,66 **** #define SHARE_VM_UTILITIES_SEMAPHORE_HPP #include "memory/allocation.hpp" #include "utilities/globalDefinitions.hpp" ! #define IMPLEMENTS_SEMAPHORE_CLASS 1 ! ! #if defined(TARGET_OS_FAMILY_bsd) # include "semaphore_bsd.hpp" - #elif defined(TARGET_OS_FAMILY_linux) - # include "semaphore_linux.hpp" - #elif defined(TARGET_OS_FAMILY_solaris) - # include "semaphore_solaris.hpp" #elif defined(TARGET_OS_FAMILY_windows) # include "semaphore_windows.hpp" #else ! // Redefine for platforms that don't implement the Semaphore class. ! # undef IMPLEMENTS_SEMAPHORE_CLASS ! # define IMPLEMENTS_SEMAPHORE_CLASS 0 #endif - #if IMPLEMENTS_SEMAPHORE_CLASS - class Semaphore : public CHeapObj<mtInternal> { public: static const uint NoMaxCount = (uint)-1; Semaphore(uint value = 0, uint max = NoMaxCount); ! ~Semaphore(); void signal(); void signal(uint count); void wait(); - bool trywait(); - bool timedwait(unsigned int sec, int nsec); - private: - os_semaphore_t _semaphore; }; - #endif - #endif // SHARE_VM_UTILITIES_SEMAPHORE_HPP --- 26,62 ---- #define SHARE_VM_UTILITIES_SEMAPHORE_HPP #include "memory/allocation.hpp" #include "utilities/globalDefinitions.hpp" ! #if defined(TARGET_OS_FAMILY_linux) || defined(TARGET_OS_FAMILY_solaris) || defined(TARGET_OS_FAMILY_aix) ! # include "semaphore_posix.hpp" ! #elif defined(TARGET_OS_FAMILY_bsd) # include "semaphore_bsd.hpp" #elif defined(TARGET_OS_FAMILY_windows) # include "semaphore_windows.hpp" #else ! # error "No semaphore implementation provided for this OS" #endif class Semaphore : public CHeapObj<mtInternal> { + private: + // Prevent copying and assignment of Semaphore instances. + Semaphore(const Semaphore &); + Semaphore& operator=(const Semaphore&); + + protected: + os_semaphore_t _semaphore; + public: static const uint NoMaxCount = (uint)-1; Semaphore(uint value = 0, uint max = NoMaxCount); ! virtual ~Semaphore(); ! void signal(); void signal(uint count); + void wait(); }; #endif // SHARE_VM_UTILITIES_SEMAPHORE_HPP
< prev index next >