I am trying to write a user-level thread library in C. My strategy is to use ucontext_t, signal, sigaction to support thread creation, initiation, join, mutex, yield, cancel, and exit. Without pre-emption, my code currently works with all the methods. But when I try to add pre-emption support, the program seems running funny and confusing. So I need to see some examples, better implemented in C. I am new to C, and have only started C program from 20 days ago. I am comfortable with using struct, pointer, pointer's pointer, context, signal, signalpromask and sigaction, etc. The pre-emption requirements just throw me way off...
github.com/noxrepo/nox-classic/blob/destiny/src/lib/threads/cooperative.cc github.com/noxrepo/nox-classic/blob/destiny/src/lib/threads/impl.cc 几年前看过的 user space thread, C++ over C, 是 Stanford 的 OpenFlow Switch 的 controller
zan. J20 scared lots of people around the globe. I remember at that time when China sent Yang Liwei up in space, a CNN news reporter televised the message to the ISS astronauts, "China made history today....." I could hear his voice in such a shock. One ISS astronaut said, "That's good. I have only vladimir here, that makes us feel less alone." That day, I was giving a technical speech with a large audience, you know, I could hear people are so focused to what I was about to deliver, although my talk was not related to space. hehe. That kind of attention made me feel so proud of China. This time, it is doing similar things to me~~ haha.