Files
swift-nio/Tests
Johannes Weiss 8b062c0317 SAL: more sync between test and EL threads (#1749)
Motivation:

The SAL (Syscall Abstraction Layer) virtualises pretty much all system
resources that NIO uses, except time and threads. That means that unless
explicitly made sure, the EL thread and the test thread run at their own
pace.

The synchronisation point is whenever the EL thread makes a
(virtualised) syscall which the test thread then sees (and asserts).

The problem in #1748 was that we were assuming that the EL thread would
park itself very fast. So when the test driver thread came along to
execute something on the EL, it just assumed that the EL has already
parked (ie. waited for a wakeup). Seemingly that works most of the time
but not always.

Modifications:

- Always actually wait for the EL to park itself.
- Delete duplicated code in `salWait` to use `runSAL`
- fixes #1748

Result:

Fewer races.
2021-02-17 08:33:22 +00:00
..