mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-23 12:13:22 +00:00
new:kzalloc
This commit is contained in:
@ -37,14 +37,14 @@ void mutex_lock(mutex_t *lock)
|
||||
spin_lock(&lock->wait_lock);
|
||||
if (likely(mutex_is_locked(lock)))
|
||||
{
|
||||
struct mutex_waiter_t *waiter = (struct mutex_waiter_t *)kmalloc(sizeof(struct mutex_waiter_t), 0);
|
||||
struct mutex_waiter_t *waiter = (struct mutex_waiter_t *)kzalloc(sizeof(struct mutex_waiter_t), 0);
|
||||
if (waiter == NULL)
|
||||
{
|
||||
kerror("In mutex_lock: no memory to alloc waiter. Program's behaviour might be indetermined!");
|
||||
spin_unlock(&lock->wait_lock);
|
||||
return;
|
||||
}
|
||||
memset(waiter, 0, sizeof(struct mutex_waiter_t));
|
||||
// memset(waiter, 0, sizeof(struct mutex_waiter_t));
|
||||
waiter->pcb = current_pcb;
|
||||
list_init(&waiter->list);
|
||||
list_append(&lock->wait_list, &waiter->list);
|
||||
|
Reference in New Issue
Block a user