mirror of
https://github.com/Pithikos/C-Thread-Pool
synced 2024-11-22 05:31:18 +03:00
Memore leaks solved
This commit is contained in:
parent
c91ab00300
commit
3a844f4dfb
3
thpool.c
3
thpool.c
@ -247,7 +247,8 @@ static void* thread_do(thread_t* thread){
|
||||
thpool->threads_alive --;
|
||||
pthread_mutex_unlock(&thpool->thcount_lock);
|
||||
printf("Thread %d exiting\n", (*thread).id);
|
||||
pthread_exit(NULL);
|
||||
//pthread_exit(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
19
thpool.h
19
thpool.h
@ -52,6 +52,7 @@
|
||||
* |___________| | |..
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@ -211,12 +212,11 @@ void thpool_destroy(thpool_t* thpool);
|
||||
* Notice also that the thread's id is not populated automatically.
|
||||
*
|
||||
* @param threadpool threadpool to create thread
|
||||
* @param thread pointer to the thread that will be created
|
||||
* @param thread address to the pointer of the thread to be created
|
||||
* @param id id to be given to thread
|
||||
*
|
||||
* @return the initialized thread
|
||||
*/
|
||||
thread_t* thread_init(thpool_t* thpool, thread_t* thread, int id);
|
||||
void thread_init(thpool_t* thpool, thread_t** thread, int id);
|
||||
|
||||
|
||||
/**
|
||||
@ -239,6 +239,16 @@ static void* thread_do(thread_t* thread);
|
||||
static void thread_hold();
|
||||
|
||||
|
||||
/**
|
||||
* @brief Frees a thread
|
||||
* @param thread
|
||||
* @return nothing
|
||||
*/
|
||||
static void thread_destroy(thread_t* thread);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ----------------------- Queue specific --------------------------- */
|
||||
|
||||
@ -306,7 +316,8 @@ static void jobqueue_destroy(thpool_t* thpool);
|
||||
|
||||
|
||||
|
||||
/* ======================== SYNCHRONISATION ========================= */
|
||||
/* ----------------------- Synchronisation -------------------------- */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Inits semaphore to given value
|
||||
|
Loading…
Reference in New Issue
Block a user