News for hackers. Stuff that matters.
Re:Tokio 1.0 – async runtime for Rust by slavik81 on Wednesday December 23, 2020 @08:26PM (#25524273)
> A non-async function is "regular logic", it must complete without blocking.

What does 'blocking' mean? I would expect the definition of synchronous to be the exact opposite; i.e., a synchronous function must block the caller until the function has finished executing. For that matter, what is "regular logic"? The name implies there is some sort of "irregular logic" to contrast it with.

I get the feeling that the writing may be unclear because the concepts are themselves not well-defined.

Re:Tokio 1.0 – async runtime for Rust by tijsvd on Thursday December 24, 2020 @01:29AM (#25525472)
Sorry for the wording, the term blocking is common in network programming.

With blocking I mean waiting. For I/O to complete, for time to pass, or for another task to complete something. In event-based programming, functions must not block. Async functions may seem to block, but they don't rely because a state machine is involved.

Re:Tokio 1.0 – async runtime for Rust by slavik81 on Thursday December 24, 2020 @02:29PM (#25530605)
That does answer my question, but I don't really understand why the distinction is made. To the caller, a function that spends time waiting and a function that spends the same time calculating both look the same, don't they?
Re:Tokio 1.0 – async runtime for Rust by ubercow13 on Thursday December 24, 2020 @07:40PM (#25533074)
The difference is that the runtime can schedule something else if the blocking is async. It looks the same as sync blocking to the caller, but not the scheduler. The point of async is you can write code that looks synchronous but is actually participating in cooperative multitasking.
Re:Tokio 1.0 – async runtime for Rust by slavik81 on Friday December 25, 2020 @03:25AM (#25535104)
I was expecting there to be more to it than that, but I understand their point now.
Re:Tokio 1.0 – async runtime for Rust by bigiain on Wednesday December 23, 2020 @09:43PM (#25524597)
My reading of that was 'you must write your non-async "regular logic" functions so that they cannot block.'