Disabled external gits

This commit is contained in:
2022-04-07 18:46:57 +02:00
parent 88cb3426ad
commit 15e7120d6d
5316 changed files with 4563444 additions and 6 deletions

View File

@@ -0,0 +1,27 @@
#include "lock.h"
bool lock_init(struct lock_t* lock) {
return pthread_mutex_init(&(lock->mutex), NULL) == 0
&& pthread_cond_init(&(lock->cv), NULL) == 0;
}
void lock_cleanup(struct lock_t* lock) {
pthread_mutex_destroy(&(lock->mutex));
pthread_cond_destroy(&(lock->cv));
}
bool lock_acquire(struct lock_t* lock) {
return pthread_mutex_lock(&(lock->mutex)) == 0;
}
void lock_release(struct lock_t* lock) {
pthread_mutex_unlock(&(lock->mutex));
}
void lock_wait(struct lock_t* lock) {
pthread_cond_wait(&(lock->cv), &(lock->mutex));
}
void lock_wake_up(struct lock_t* lock) {
pthread_cond_broadcast(&(lock->cv));
}