"A computer is a state machine. Threads are for people who can't
program state machines."
-- Alan Cox
2004-02-08 | Version 0.4 was released. A theoretically damaging bug was fixed involving delete[] vs delete, spotted by Valgrind. There is tentative Solaris support, not heavily tested. Furthermore, a new method called numProcesses() was added so the kernel can query how many processes are running, and perhaps acting on that. |
2003-01-20 | Version 0.3 was released. This should
compile under more versions of gcc, has a new method called
getTid()
so contexts can print a numerical presentation of their identity. It also
fixes a tid accounting bug which may have affected stability.
This version powers the PowerDNS Recursing Nameserver! |
MTasker<> MT; void printer(void *p) { char c=(char)p; for(;;) { cout<<c<<endl; MT.yield(); } } int main() { MT.makeThread(printer,(void*)'a'); MT.makeThread(printer,(void*)'b'); for(;;) { // kernel loop while(MT.schedule()); // do everything we can do if(MT.noProcesses()) // exit if no processes are left break; } }