feat: moved block dev loop to a daemon task. Fixed bug in string.c and
main loop
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user