Changeset 20914
- Timestamp:
- 11/12/07 11:45:27 (10 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
juggler/branches/2.2/modules/vapor/vpr/md/POSIX/Sync/SemaphorePosix.h
r20910 r20914 47 47 48 48 #include <stdio.h> 49 #include <cstring> 49 50 #include <semaphore.h> 50 51 #include <errno.h> … … 103 104 * to acquire the semaphore itself. 104 105 * 105 * @throw vpr::DeadlockException is thrown if the current thread has 106 * already locked this semaphore. 106 * @throw vpr::DeadlockException 107 * Thrown if the current thread has already locked this semaphore. 108 * @throw vpr::LockException 109 * Thrown if the lock operation fails for reasons other than 110 * deadlock and interruption of a system call. 107 111 */ 108 112 void acquire() … … 116 120 while ( -1 == result && EINTR == errno ); 117 121 118 if ( -1 == result && EDEADLK == errno ) 119 { 120 throw vpr::DeadlockException( 121 "Tried to lock semaphore twice in the same thread", VPR_LOCATION 122 ); 123 } 124 125 assert(result == 0); 126 boost::ignore_unused_variable_warning(result); 122 if ( -1 == result ) 123 { 124 if ( EDEADLK == errno ) 125 { 126 throw vpr::DeadlockException( 127 "Tried to lock semaphore twice in the same thread", VPR_LOCATION 128 ); 129 } 130 131 std::ostringstream msg_stream; 132 msg_stream << "Failed to lock semaphore: " << std::strerror(errno); 133 throw vpr::LockException(msg_stream.str(), VPR_LOCATION); 134 } 127 135 } 128 136
