Prettify
This commit is contained in:
parent
020094376f
commit
3712dabce4
14
README.md
14
README.md
|
@ -1,11 +1,13 @@
|
||||||
````
|
````
|
||||||
Author: Johan Hanssen Seferidis
|
Author: Johan Hanssen Seferidis
|
||||||
Created: 2011-08-12
|
License: MIT
|
||||||
````
|
````
|
||||||
|
|
||||||
|
## thpool v2
|
||||||
|
|
||||||
Compiling
|
|
||||||
========================================================================
|
|
||||||
|
## Compiling
|
||||||
|
|
||||||
The library is not precompiled so you have to compile it with your project. The thread pool
|
The library is not precompiled so you have to compile it with your project. The thread pool
|
||||||
uses POSIX threads so if you compile with gcc you have to use the flag -pthread like this:
|
uses POSIX threads so if you compile with gcc you have to use the flag -pthread like this:
|
||||||
|
@ -18,8 +20,7 @@ Then run the executable like this:
|
||||||
./test
|
./test
|
||||||
|
|
||||||
|
|
||||||
Usage
|
##Usage
|
||||||
========================================================================
|
|
||||||
|
|
||||||
1. Make a thread pool: `thpool_t* thpool;`
|
1. Make a thread pool: `thpool_t* thpool;`
|
||||||
2. Initialise the thread pool with number of threads(workers) you want: `thpool=thpool_init(4);`
|
2. Initialise the thread pool with number of threads(workers) you want: `thpool=thpool_init(4);`
|
||||||
|
@ -31,8 +32,7 @@ you can use `thpool_wait(thpool);`. If you want to destroy the pool you can use
|
||||||
`thpool_destroy(thpool);`.
|
`thpool_destroy(thpool);`.
|
||||||
|
|
||||||
|
|
||||||
Threadpool Interface
|
##Threadpool Interface
|
||||||
========================================================================
|
|
||||||
|
|
||||||
````
|
````
|
||||||
NAME
|
NAME
|
||||||
|
|
|
@ -16,15 +16,13 @@
|
||||||
#include "thpool.h"
|
#include "thpool.h"
|
||||||
|
|
||||||
|
|
||||||
/* Some arbitrary task 1 */
|
|
||||||
void task1(){
|
void task1(){
|
||||||
printf("# Thread %u working on task1\n", (int)pthread_self());
|
printf("Thread #%u working on task1\n", (int)pthread_self());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Some arbitrary task 2 */
|
|
||||||
void task2(){
|
void task2(){
|
||||||
printf("# Thread %u working on task2\n", (int)pthread_self());
|
printf("Thread #%u working on task2\n", (int)pthread_self());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue