Changeset 2335
- Timestamp:
- 06/19/07 13:35:42 (1 year ago)
- Files:
-
- trunk/tango/core/sync/Condition.d (modified) (2 diffs)
- trunk/tango/core/sync/Config.d (added)
- trunk/tango/core/sync/Semaphore.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/tango/core/sync/Condition.d
r2334 r2335 21 21 else version( Posix ) 22 22 { 23 private import tango.core.sync.Config; 23 24 private import tango.stdc.errno; 24 25 private import tango.stdc.posix.pthread; … … 154 155 timespec t; 155 156 156 if( period > t.tv_sec.max ) 157 { 158 t.tv_sec = t.tv_sec.max; 159 t.tv_nsec = t.tv_nsec.max; 160 } 161 else 162 { 163 t.tv_sec = cast(typeof(t.tv_sec)) period; 164 t.tv_nsec = cast(typeof(t.tv_sec))( ( period - t.tv_sec ) * 1_000_000 ); 165 } 166 167 int rc = pthread_cond_timedwait( &m_hndl, m_mutexAddr, &t ); 168 switch( rc ) 157 setTimespec( t, absTimeout( period ) ); 158 switch( pthread_cond_timedwait( &m_hndl, m_mutexAddr, &t ) ) 169 159 { 170 160 case ETIMEDOUT: trunk/tango/core/sync/Semaphore.d
r2333 r2335 18 18 else version( Posix ) 19 19 { 20 private import tango.core.sync.Config; 20 21 private import tango.stdc.errno; 21 22 private import tango.stdc.posix.pthread; … … 155 156 timespec t; 156 157 157 if( period > t.tv_sec.max ) 158 { 159 t.tv_sec = t.tv_sec.max; 160 t.tv_nsec = t.tv_nsec.max; 161 } 162 else 163 { 164 t.tv_sec = cast(typeof(t.tv_sec)) period; 165 t.tv_nsec = cast(typeof(t.tv_sec))( ( period - t.tv_sec ) * 1_000_000 ); 166 } 167 168 int rc = sem_timedwait( &m_hndl, &t ); 169 switch( rc ) 158 setTimespec( t, absTimeout( period ) ); 159 switch( sem_timedwait( &m_hndl, &t ) ) 170 160 { 171 161 case ETIMEDOUT:












