This commit is contained in:
pithikos 2015-01-16 19:38:22 +00:00
parent 020094376f
commit 3712dabce4
2 changed files with 9 additions and 11 deletions

View File

@ -1,11 +1,13 @@
````
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
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
Usage
========================================================================
##Usage
1. Make a thread pool: `thpool_t* thpool;`
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);`.
Threadpool Interface
========================================================================
##Threadpool Interface
````
NAME

View File

@ -16,15 +16,13 @@
#include "thpool.h"
/* Some arbitrary task 1 */
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(){
printf("# Thread %u working on task2\n", (int)pthread_self());
printf("Thread #%u working on task2\n", (int)pthread_self());
}