3 ms·
Old concept but Plan 9 c and thread(2) is simple yet really nice to work with. Also helps that there is no posix junk and plan 9 threads are light weight proces
by MisterTea 6y ago
Old concept but Plan 9 c and thread(2) is simple yet really nice to work with. Also helps that there is no posix junk and plan 9 threads are light weight processes with shared memory. So libthread lets you spawn and manage processes or threads and groups them in rendezvous groups to guarantee sequential thread execution. That can eliminate the need for locks since no two threads in a rendez group will be running at the same time. Then use channels to read/write messages between procs. Way better pattern than async/await nonsense.
http://man.postnix.pw/9front/2/thread http://man.postnix.pw/9front/2/thread
example code (random 9 mirror I picked): https://github.com/mischief/9problems/blob/master/sys/src/libthread/example.c https://github.com/mischief/9problems/blob/master/sys/src/li...