Skip to content

Commit

Permalink
fixed email
Browse files Browse the repository at this point in the history
  • Loading branch information
derMihai committed Jan 8, 2025
1 parent 57d7c52 commit 06173ec
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
7 changes: 4 additions & 3 deletions core/include/wait_queue.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/*
* Copyright (C) 2025 Mihai Renea <[email protected]>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
Expand Down Expand Up @@ -87,14 +89,13 @@
* @file wait_queue.h
* @brief Linux-like wait queue for condition signaling
*
* @author Mihai Renea <mihairenea@gmail.com>
* @author Mihai Renea <mihai.renea@ml-pa.com>
*/

#ifndef WAIT_QUEUE_H
#define WAIT_QUEUE_H

#include "irq.h"
#include "thread.h"
#include "sched.h"

/* Wait queue entry, which is always allocated on the stack. We can't use the
* linked list node in thread_t because while evaluating the condition
Expand Down
27 changes: 24 additions & 3 deletions core/wq.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/*
* Copyright (C) 2025 Mihai Renea <[email protected]>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @ingroup core_sync
* @{
*
* @file
* @brief Wait queue implementation
*
* @author Mihai Renea <[email protected]>
*
* @}
*/

#include "irq.h"
#include "wait_queue.h"

#define ENABLE_DEBUG 0
Expand Down Expand Up @@ -48,8 +69,8 @@ void _wait_dequeue(wait_queue_t *wq, wait_queue_entry_t *entry)
if (*curr_pp == entry) {
*curr_pp = (*curr_pp)->next;
#ifndef NDEBUG
/* Mark as not queued only for debugging, as the entry is going out
* of scope immediately anyway. */
/* Mark as not queued only for debugging, as the entry is about to
* go out of scope anyway. */
entry->next = NULL;
#endif
break;
Expand Down Expand Up @@ -91,7 +112,7 @@ void _queue_wake_common(wait_queue_t *wq, bool all)
{
int irq_state = irq_disable();

int highest_prio = THREAD_PRIORITY_MIN + 1;
uint16_t highest_prio = THREAD_PRIORITY_MIN + 1;

wait_queue_entry_t *head;
while ((head = wq->list) != WAIT_QUEUE_TAIL) {
Expand Down
1 change: 0 additions & 1 deletion tests/core/wait_queue/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ USEMODULE += sema

DEVELHELP ?= 0
ASSERT_VERBOSE ?= 0
# CFLAGS_OPT += -Og -g
10 changes: 5 additions & 5 deletions tests/core/wait_queue/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2025 Mihai Renea
* Copyright (C) 2025 Mihai Renea <[email protected]>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
Expand All @@ -13,7 +13,7 @@
* @file
* @brief Test application for wait queues
*
* @author Mihai Renea <mihairenea@gmail.com>
* @author Mihai Renea <mihai.renea@ml-pa.com>
* @}
*/

Expand Down Expand Up @@ -243,8 +243,9 @@ static uint64_t nested_cond_val = 0;

static bool cond_fn_wq(unsigned waiter_no)
{
QUEUE_WAIT(&nested_wq, COUNTING_COND(nested_cond_iter_cnt,
atomic_load_u64(&nested_cond_val) >= COND_VAL_THRESHOLD));
QUEUE_WAIT(&nested_wq,
COUNTING_COND(nested_cond_iter_cnt,
atomic_load_u64(&nested_cond_val) >= COND_VAL_THRESHOLD));
DEBUG("waiter %u: past inner wq\n", waiter_no);
return atomic_load_u64(&cond_val) >= COND_VAL_THRESHOLD;
}
Expand Down Expand Up @@ -361,7 +362,6 @@ void test_waiters_blocking_wq(void)
nested_cond_val = 0;
queue_wake(&nested_wq);


nested_cond_iter_cnt_expected += WAITERS_CNT;
expect(nested_wq.list != WAIT_QUEUE_TAIL);
expect(atomic_load_u32(&nested_cond_iter_cnt) == nested_cond_iter_cnt_expected);
Expand Down
4 changes: 2 additions & 2 deletions tests/core/wait_queue/tests/01-run.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python3

# Copyright (C) 2025 Mihai Renea
# Copyright (C) 2025 Mihai Renea <[email protected]>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.

# Author: Mihai Renea <mihairenea@gmail.com>
# Author: Mihai Renea <mihai.renea@ml-pa.com>

import sys
from testrunner import run
Expand Down

0 comments on commit 06173ec

Please sign in to comment.