feat: moved block dev loop to a daemon task. Fixed bug in string.c and

main loop
This commit is contained in:
2021-03-01 21:42:35 +01:00
parent 990b850c43
commit 76792dd6fd
7 changed files with 32 additions and 21 deletions

View File

@@ -30,9 +30,9 @@ struct spinlock {
volatile uint32_t lock;
};
semaphore_t *semaphore_create() {
semaphore_t *semaphore_create(int32_t start) {
semaphore_t *semaphore = malloc(sizeof(semaphore_t));
semaphore->value = 1;
semaphore->value = start;
return semaphore;
}
@@ -54,7 +54,7 @@ void semaphore_wait(semaphore_t *semaphore) {
}
void semaphore_signal(semaphore_t *semaphore) {
if (__sync_add_and_fetch(&semaphore->value, 1) == 1) {
if (__sync_add_and_fetch(&semaphore->value, 1) >= 1) {
return; // last in queue
}
task_lock_acquire();

View File

@@ -13,7 +13,7 @@ typedef struct mutex mutex_t;
typedef struct spinlock spinlock_t;
semaphore_t *semaphore_create();
semaphore_t *semaphore_create(int32_t start);
void semaphore_wait(semaphore_t *semaphore);