This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Brian Reily (author)
Wed Jan 28 16:53:46 -0800 2009
twine /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
Makefile | ||
| |
Makefile.rb | ||
| |
README | ||
| |
mutex_test.c | ||
| |
thread.c | ||
| |
thread.h | ||
| |
thread_test.c |
README
( (
) )
( 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
(
-- I'm probably not going to do any more work on this, but if I
were, here are some possible improvements that could be made -
or you could fork, implement them or others, and I'll pull it
back.
-- 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.
-- Priority scheduling - I had planned on having it, but I never got
around to it.








