Conclusion

Conclusion

Conclusion

Zig is a really new language which is not very mature yet, that is why you mind find only a few ressources online about the state of concurrency in Zig. However there are already a few pioneers who have really intersting projects or talks. The first that greatly helped understand concurency especially in Zig is King Protty who answered a few of my questions on the Zig Discord server and also made 2 nice videos 1 2. The big project that uses concurency in Zig is TigerBeetle whish is an highly efficient database engine using.

The normal way to do async IO in Zig would be to use its async/await feature, but since it is not supported anymore it is completly out of the picture for now. If you still find it interesting to work this way then Zigocoro might be the best fit since it is almost the interface so when async/await will come back into the language it will be an easy migration, except if the async/await of the language release breaking changes.

The most traditional and easiest way to deal with asynchronous code would be to use Kernel threads that are available in standard library making it easy to use without having to import any external library. The basic functionnalites are very equivalent to those of POSIX threads making it easy to understand for any C developer.

If you want to monitor non-blocking IO operations without spawning kernel threads which have a big overhead, libuv is the event loop that you should use and epoll if you prefer a lower abstraction level and only need to work linux.

If none of those solutions fit your needs, don't forget that you can always use any C library.

Sources: