breily/twine
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
( Twine -- An Unassuming Little Threading Library ( ) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ) ) ( Features ) -- Easy userspace threads -- Thread preemption after 10ms time slice -- Mutexes ) ( Usage ) -- Look at thread_test.c to see basic thread usage, and mutex_test.c for mutex usage. -- But basically: twine_init(); // start the library twine_create(foo, x); // create a thread twine_yield(); // yield control to another thread ( ) Notes ( -- Only compiles on Linux (or anything with the makecontext, setcontext, etc. functions, which for some reason are missing on OSX). ( ) Improvements ( -- Currently the twine_create function only accepts functions that return void and have one argument. I know of no way of getting around the void return, but you can allow more arguments by changing our call to makecontext in thread.c. See /usr/includes/ucontext.h for details. -- Figuring out a better slice time (10ms was pretty much picked at random), or letting the user set it when he calls twine_init.
About
simple c multithreading
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published