On a Linux system, will the current thread sleep or block while executing the sem_timewait (), while waiting for the lock

on Linux, while executing sem_timewait (), will the current thread sleep, choose another thread to execute, or block in place until it times out?

after the timeout, if the lock has not been acquired, do you sleep or block the current process?

Mar.17,2021

if you are talking about sem_timedwait :

as far as I can remember, only spin locks block in place, while other Synchronize mechanisms sleep.

the second problem is mentioned in the man manual. When the timeout has not yet acquired the lock, the function will return an error failure of timeout, and errno will set ETIMEDOUT

.
If the timeout has already expired by the time of the call, and the semaphore could not be locked immediately, then sem_timedwait () fails with a timeout error (errno set to ETIMEDOUT).

The

sem_timewait function blocks the current thread until it gets the lock or times out. Blocking is implemented by sleeping the current thread until the lock is released or wakes up after the timeout. After the
timeout, this function returns to continue executing the following code, which logically determines the subsequent behavior.

hibernation is an implementation or expression of blocking, and the two are not the same level of concept.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5cea4-59c74.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5cea4-59c74.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?