|
|
|
|
|
by dwattttt
595 days ago
|
|
The code linked does the following: - attempt to acquire an RWLock without blocking - if it does, wake the task waiting for the lock - if it doesn't, return "not ready yet" The RWLock is straight from the standard lib; there's no loop and no spinning involved. Every single Future you look at will look like this, by specification they cannot block, only return "ready" (and wake the task), or return "not ready". |
|
It really is not much different to a thread blocking on a loop, where the OS thread scheduler will pre-empt the thread, rescheduling it for later. In this case it's an async task instead of a thread, and cooperative instead of preemptive, but it's still unfair and not very effective use of scheduler resources