From 4879775d0b07f3d86af6d7b579e86bb01a7cc61c Mon Sep 17 00:00:00 2001 From: sBubshait Date: Wed, 23 Oct 2024 16:32:40 +0100 Subject: [PATCH] Update donate priority to add an assertion that intrrupts are disabled, w/ T --- src/threads/synch.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/threads/synch.c b/src/threads/synch.c index 7831774..940faa5 100644 --- a/src/threads/synch.c +++ b/src/threads/synch.c @@ -196,9 +196,12 @@ lock_init (struct lock *lock) /* Current thread donates its priority to donee, iteratively propagating the donation in the case of chains in the wait-for graph. - Also keeps track of the donation by updating the donors list. */ + Also keeps track of the donation by updating the donors list. Expects + interrupts to be disabled. */ static void donate_priority (struct thread *donee) { + ASSERT (intr_get_level () == INTR_OFF); + struct thread *donor = thread_current (); list_push_back (&donee->donors_list, &donor->donor_elem);