diff options
| author | Christian Cunningham <cc@localhost> | 2022-08-26 23:27:46 -0700 | 
|---|---|---|
| committer | Christian Cunningham <cc@localhost> | 2022-08-26 23:27:46 -0700 | 
| commit | 41a7818b552aef9e6e0bf788089f6ae16ae1e421 (patch) | |
| tree | 87b4010b7f24a75d497450b3d98fc4f8f667e404 /kernel/lib | |
| parent | 8b36a39774789cee66d84db9f0086af15cacc211 (diff) | |
Mutex wait queuesno-search
Diffstat (limited to 'kernel/lib')
| -rw-r--r-- | kernel/lib/queue.c | 43 | 
1 files changed, 6 insertions, 37 deletions
| diff --git a/kernel/lib/queue.c b/kernel/lib/queue.c index 1fc35f6..38ef8cf 100644 --- a/kernel/lib/queue.c +++ b/kernel/lib/queue.c @@ -2,54 +2,23 @@  void push_to_queue(struct Entry* e, struct Queue* q)  { -	q->end.next->next = e; -	q->end.next = e; -	e->next = &q->end; -} - -void prepend_to_queue(struct Entry* e, struct Queue* q) -{  	e->next = q->start.next;  	q->start.next = e; -	if (e->next->entry_type == END_ENTRY) -		q->end.next = e;  }  struct Entry* pop_from_queue(struct Queue* q)  { -	if (q->start.next->entry_type == END_ENTRY) +	if (q->start.next == 0)  		return 0;  	struct Entry* e = q->start.next;  	q->start.next = e->next; -	if (e->next->entry_type == END_ENTRY) -		q->end.next = &q->start;  	return e;  } -struct Entry* remove_next_from_queue(struct Entry* e) -{ -	struct Entry* prev = e; -	struct Entry* remove = e->next; -	struct Entry* next = remove->next; -	if (remove->entry_type != VALUE_ENTRY) +struct Entry* remove_next_from_queue(struct Entry* e) { +	if (e->next == 0)  		return 0; -	prev->next = next; -	if (next->entry_type == END_ENTRY) -		next->next = prev; -	return remove; -} - -struct Entry* find_value(void* value, struct Queue* q) -{ -	struct Entry* prev; -	struct Entry* entry; -	prev = &q->start; -	entry = prev->next; -	while (entry->entry_type != END_ENTRY) { -		if (entry->value == value) -			return prev; -		prev = entry; -		entry = prev->next; -	} -	return 0; +	struct Entry* next = e->next; +	e->next = next->next; +	return next;  } | 
