faern / oneshot

Oneshot Rust channel working both in and between sync and async environments
Apache License 2.0
80 stars 9 forks source link

Fix try_recv (And add a bunch of loom based tests) #23

Closed faern closed 2 years ago

faern commented 2 years ago

Just after publishing 0.1.4 I realized that the try_recv method did not properly handle being in the UNPARKING state. I wrote a loom based test proving this was the case, then I fixed the issue. I added a bunch of more loom tests while at it. Verifying that a lot of other poll interactions act sanely.

Ping @Cassy343. What do you think? There are too many combinations on how one can call this library right now. To be fully correct we should also have tests trying to call recv, recv_timeout etc after polling also. But that's going to explode in number of tests. This will be mitigated with 0.2 where these call combinations are no longer possible.

Cassy343 commented 2 years ago

Yeah good catch there. To be honest I wouldn't worry too much about these degenerate cases since they're already stemming from a pretty substantial misuse of the library, and because as you mentioned these will be fixed by the end of next month.