处理`sem_timedwait()`返回的`EINTR`错误
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 74
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
现在的代码在sem_timedwait()返回时,会:
- success
- time out
- 根据errno进行throw
sem_timedwait()函数会syscall被singal处理打断时,会返回EINTR错误,并不代表出现了问题,只是交由用户判断是否继续wait。
现在的版本在遇到EINTR时会当作错误处理,造成如下效果:
详情请见:
https://linux.die.net/man/3/sem_timedwait
https://stackoverflow.com/a/52332012
较为合适的做法是:
while ((s = sem_timedwait(&sem, &ts)) == -1 && errno == EINTR)
continue; /* Restart if interrupted by handler */
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the sem_timedwait() call and inspect how its return value and errno are handled. Confirm the current behavior against the linked man page, then make EINTR retry without changing success, timeout, or other-error handling; verify with the project’s existing tests or reproduction if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100