mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 08:32:43 +00:00 
			
		
		
		
	test-pthread: Check for correct return value from sem_trywait()
At some point `sem_trywait()` changed from returning an error code on failure to returning -1 and setting the errno. Update test-pthread to expect this behavior.
This commit is contained in:
		
							parent
							
								
									dab991284f
								
							
						
					
					
						commit
						d04968fee4
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		|  | @ -107,7 +107,8 @@ static ErrorOr<void> test_semaphore_as_lock() | |||
| 
 | ||||
|     VERIFY(v.size() == threads_count * num_times); | ||||
|     VERIFY(sem_trywait(&semaphore) == 0); | ||||
|     VERIFY(sem_trywait(&semaphore) == EAGAIN); | ||||
|     VERIFY(sem_trywait(&semaphore) == -1); | ||||
|     VERIFY(errno == EAGAIN); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
|  | @ -136,7 +137,8 @@ static ErrorOr<void> test_semaphore_as_event() | |||
|     [[maybe_unused]] auto r1 = reader->join(); | ||||
|     [[maybe_unused]] auto r2 = writer->join(); | ||||
| 
 | ||||
|     VERIFY(sem_trywait(&semaphore) == EAGAIN); | ||||
|     VERIFY(sem_trywait(&semaphore) == -1); | ||||
|     VERIFY(errno == EAGAIN); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
|  | @ -181,7 +183,8 @@ static ErrorOr<void> test_semaphore_nonbinary() | |||
|     for (size_t i = 0; i < num; i++) { | ||||
|         VERIFY(sem_trywait(&semaphore) == 0); | ||||
|     } | ||||
|     VERIFY(sem_trywait(&semaphore) == EAGAIN); | ||||
|     VERIFY(sem_trywait(&semaphore) == -1); | ||||
|     VERIFY(errno == EAGAIN); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Tim Ledbetter
						Tim Ledbetter