News for hackers. Stuff that matters.
Re:Async.h – asynchronous, stackless subroutines in C by innagadadavida on Saturday September 21, 2019 @03:21AM (#21034002)
Does anyone use Apple’s libdispatch (aka GCD) on Linux production code? It seems to be pretty fast and has some neat features. It also gives you blocks/closure support in C (needs Clang).
Re:Async.h – asynchronous, stackless subroutines in C by shakna on Saturday September 21, 2019 @06:46AM (#21034562)
> It also gives you blocks/closure support in C (needs Clang).

You get block statements just with Clang don't you? No need for libdispatch?

And you can kinda get blocks with GCC as well using a similar construct. (For the love of all that is holy, don't actually use this macro).

      #define lambda(ret_type, _body) ({ ret_type _ _body _; })
I don't quite remember, but from when I was working things out, this worked _most_ of the time for both GCC and clang.
Re:Async.h – asynchronous, stackless subroutines in C by Matthias247 on Saturday September 21, 2019 @10:26PM (#21039252)
If you are open to C++ [boost] asio is pretty close and is cross platform. Running an io_service on a thread gives you something that resembles a dispatch_queue. And instead of blocks you can post C++ closures to the queues.
Re:Async.h – asynchronous, stackless subroutines in C by Yoric on Saturday September 21, 2019 @07:59AM (#21034783)
Oh, libdispatch has been ported to other platforms?

That's great!

Re:Async.h – asynchronous, stackless subroutines in C by innagadadavida on Saturday September 21, 2019 @10:45AM (#21035659)
Was available in FreeBSD back in 2009: https://wiki.freebsd.org/GCD Archived Linux port: https://github.com/nickhutchinson/libdispatch You can use this without blocks, but it is way more convenient with blocks.
Re:Async.h – asynchronous, stackless subroutines in C by Yoric on Saturday September 21, 2019 @02:22PM (#21036992)
Good to know, thanks!
Re:Async.h – asynchronous, stackless subroutines in C by gigatexal on Saturday September 21, 2019 @04:53AM (#21034247)
+1 to this question I too am curious