You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the way to start a new fiber, is by using the keyword async. This might be somewhat confusing for people coming from C# or Python (like me).
I'd like to suggest renaming async to spawn, so that it is clear a fiber is spawned at that point in the code.
Another thing which is available in python and C# is the await keyword, this could be useful to await the returned futures. Maybe a macro for this would be a nice syntactic sugar.
The text was updated successfully, but these errors were encountered:
async matches the behavior of std::async, so the term seems to make sense. However, being a macro may lead to issues when including other headers, such as <future> (although that specific header would not be needed when using Zth). Using such kind of macros with commonly used names may not be feasible in the long run anyway. So, I made the following changes for version 1.1.0:
zth_async is defined as the original behavior of async. To prevent defining async, make sure to define ZTH_NO_ASYNC_KEYWORD before including <zth>. Then, you are free to define your own spawn to zth_async.
zth::fiber() is added to create a fiber. It can be used instead of async. See the 7_no_async example.
Currently, the way to start a new fiber, is by using the keyword
async
. This might be somewhat confusing for people coming fromC#
orPython
(like me).I'd like to suggest renaming
async
tospawn
, so that it is clear a fiber is spawned at that point in the code.Another thing which is available in python and C# is the
await
keyword, this could be useful toawait
the returned futures. Maybe a macro for this would be a nice syntactic sugar.The text was updated successfully, but these errors were encountered: