mirror of
https://github.com/0intro/libtask
synced 2024-11-21 21:31:30 +03:00
move README to README.md
This commit is contained in:
parent
798c8c6df8
commit
1bd5583c53
@ -1,3 +1,9 @@
|
||||
Libtask: a Coroutine Library for C and Unix
|
||||
===========================================
|
||||
|
||||
[![Build Status](https://drone.io/github.com/0intro/libtask/status.png)](https://drone.io/github.com/0intro/libtask/latest)
|
||||
[![Coverity Scan Status](https://scan.coverity.com/projects/5467/badge.svg)](https://scan.coverity.com/projects/5467)
|
||||
|
||||
Libtask is a simple coroutine library. It runs on Linux (ARM, MIPS, and x86),
|
||||
FreeBSD (x86), OS X (PowerPC x86, and x86-64), and SunOS Solaris (Sparc),
|
||||
and is easy to port to other systems.
|
||||
@ -12,7 +18,8 @@ the CPU. Most of the functions provided in task.h do have
|
||||
the possibility of going to sleep. Programs using the task
|
||||
functions should #include <task.h>.
|
||||
|
||||
--- Basic task manipulation
|
||||
Basic task manipulation
|
||||
-----------------------
|
||||
|
||||
int taskcreate(void (*f)(void *arg), void *arg, unsigned int stacksize);
|
||||
|
||||
@ -83,7 +90,8 @@ unsigned int taskid(void);
|
||||
|
||||
Return the unique task id for the current task.
|
||||
|
||||
--- Non-blocking I/O
|
||||
Non-blocking I/O
|
||||
----------------
|
||||
|
||||
There is a small amount of runtime support for non-blocking I/O
|
||||
on file descriptors.
|
||||
@ -116,7 +124,8 @@ void fdwait(int fd, int rw);
|
||||
anything else means just exceptional conditions (hang up, etc.)
|
||||
The 'r' and 'w' also wake up for exceptional conditions.
|
||||
|
||||
--- Network I/O
|
||||
Network I/O
|
||||
-----------
|
||||
|
||||
These are convenient packaging of the ugly Unix socket routines.
|
||||
They can all put the current task to sleep during the call.
|
||||
@ -154,14 +163,16 @@ int netdial(int proto, char *name, int port)
|
||||
Example: netdial(TCP, "www.google.com", 80)
|
||||
or netdial(TCP, "18.26.4.9", 80)
|
||||
|
||||
--- Time
|
||||
Time
|
||||
----
|
||||
|
||||
unsigned int taskdelay(unsigned int ms)
|
||||
|
||||
Put the current task to sleep for approximately ms milliseconds.
|
||||
Return the actual amount of time slept, in milliseconds.
|
||||
|
||||
--- Example programs
|
||||
Example programs
|
||||
----------------
|
||||
|
||||
In this directory, tcpproxy.c is a simple TCP proxy that illustrates
|
||||
most of the above. You can run
|
||||
@ -175,7 +186,8 @@ Other examples are:
|
||||
httpload.c - simple HTTP load generator
|
||||
testdelay.c - test taskdelay()
|
||||
|
||||
--- Building
|
||||
Building
|
||||
--------
|
||||
|
||||
To build, run make. You can run make install to copy task.h and
|
||||
libtask.a to the appropriate places in /usr/local. Then you
|
||||
@ -184,7 +196,8 @@ that use it.
|
||||
|
||||
On SunOS Solaris machines, run makesun instead of just make.
|
||||
|
||||
--- Contact Info
|
||||
Contact Info
|
||||
------------
|
||||
|
||||
Please email me with questions or problems.
|
||||
|
||||
@ -192,8 +205,8 @@ Russ Cox
|
||||
rsc@swtch.com
|
||||
|
||||
|
||||
--- Stuff you probably won't use at first ---
|
||||
--- but might want to know about eventually ---
|
||||
Stuff you probably won't use at first but might want to know about eventually
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
void tasksleep(Rendez*);
|
||||
int taskwakeup(Rendez*);
|
||||
@ -247,5 +260,3 @@ etc.
|
||||
http://swtch.com/~rsc/thread/
|
||||
and also the example program primes.c, which implements
|
||||
a concurrent prime sieve.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user