Semaphore: Change timedWait to wait in microseconds

CQTexperiment
Christopher Snowhill 2022-01-14 22:43:46 -08:00
parent 74cd0f7da9
commit ccbfc6ec4b
2 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@
-(id)init;
-(void)signal;
-(void)timedWait:(int)seconds;
-(void)timedWait:(int)microseconds;
-(void)wait;
-(void)waitIndefinitely;

View File

@ -27,9 +27,9 @@
semaphore_signal_all(semaphore);
}
-(void)timedWait:(int)seconds
-(void)timedWait:(int)microseconds
{
mach_timespec_t timeout = {seconds, 0};
mach_timespec_t timeout = {0, microseconds * 1000UL};
semaphore_timedwait(semaphore, timeout);
}