fix: Watcher on MacOS #254
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
之前版本那个 watcher 在 Mac OS 上挂掉的原因找到了,fclose stdio 流似乎是未定义行为.改为重定向到 /dev/null 即可在 mac 上通过 watcher test.
同时,之前版本的 watcher 记时有个小问题,当题目的 time limit 过小时,由于 rlimit 的 CPU 限制只能上取整到整数秒,就会出现「rlimit 的 CPU 时间限制」>「judging thread 的 kill 时间」,从而返回「程序无法运行,watcher time limit exceed 的结果」.把 judging thread kill 时间也上取整一下就好了.