-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththreads.h
More file actions
31 lines (24 loc) · 745 Bytes
/
threads.h
File metadata and controls
31 lines (24 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef THR_H
#define THR_H
#include <pthread.h>
#include "../lst/list.h"
void poolThreads(int numberThreads, void *(*fnThread)());
int getNumberThreads(char *numThreads);
/* Mutex */
void initLockMutex();
void lockMutex();
void unlockMutex();
void destroyMutex();
void wait(pthread_cond_t *varCond);
void signal(pthread_cond_t *varCond);
void broadcast(pthread_cond_t *varCond);
/* RW */
void initLockRW(pthread_rwlock_t* lockRW);
void lockReadRW(pthread_rwlock_t *lockRW);
void lockWriteRW(pthread_rwlock_t *lockRW);
int tryLockRead(pthread_rwlock_t *lockRW);
int tryLockWrite(pthread_rwlock_t *lockRW);
void unlockRW(pthread_rwlock_t *lockRW);
void destroyRW(pthread_rwlock_t *lockRW);
void unlockItem (pthread_rwlock_t* _item);
#endif