Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/cmrx/algo.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@
* items rather than allocation size)
*/
#define ARRAY_DELETE(_ARRAY, _POS, _SIZE) \
for (unsigned q = _POS + 1; q < _SIZE; ++q)\
for (unsigned _q = _POS + 1; _q < _SIZE; ++_q)\
{\
_ARRAY[q - 1] = _ARRAY[q];\
_ARRAY[_q - 1] = _ARRAY[_q];\
}\
_SIZE--;

Expand Down Expand Up @@ -237,7 +237,7 @@ inline uint32_t os_hash_key(uint32_t key)
const uint32_t mask = (_MAX) - 1;\
uint32_t pos = hash & mask;\
uint32_t stride = 1;\
while (_HASHTABLE[pos]._KEY != _VALUE && _HASHTABLE[pos]._KEY != HASH_EMPTY) {\
while (_HASHTABLE[pos]._KEY != _VALUE && _HASHTABLE[pos]._KEY != (typeof(_HASHTABLE[0]._KEY)) HASH_EMPTY) {\
pos = (pos + stride) & mask;\
stride++;\
}\
Expand Down
1 change: 1 addition & 0 deletions src/os/arch/arm/cmsis/arch/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
if (!(cond)) \
{\
asm volatile("BKPT 0xFF\n\t");\
__builtin_unreachable();\
}
#else
# define ASSERT(cond)
Expand Down
16 changes: 15 additions & 1 deletion src/os/kernel/notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ int os_notify_object(const void * object, Event_t event, uint32_t flags)
txn_id = os_txn_start();

candidate_waiter = os_find_notified_thread_waiter(object);
candidate_timer = os_find_timer(os_notification_waiters[candidate_waiter], TIMER_TIMEOUT);
if (candidate_waiter < OS_THREADS)
{
candidate_timer = os_find_timer(os_notification_waiters[candidate_waiter], TIMER_TIMEOUT);
}
} while (os_txn_commit(txn_id, TXN_READWRITE) != E_OK);

if (candidate_waiter < OS_THREADS)
Expand Down Expand Up @@ -282,6 +285,17 @@ void cb_syscall_notify_object(const void * object, Thread_t thread, int sleeper,

case EVT_TIMEOUT:
os_set_syscall_return_value(thread, E_TIMEOUT);
for (unsigned q = 0; q < os_notification_waiters_size; ++q)
{
if (os_notification_waiters[q] == thread)
{
ARRAY_DELETE(os_notification_waiters, q, os_notification_waiters_size);
break;
}
}
notified_thread->wait_object = NULL;
notified_thread->wait_callback = NULL;

break;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/os/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,8 @@ uint32_t os_shutdown(void)
os_memory_protection_stop();

os_kernel_shutdown();

__builtin_unreachable();
}

struct OS_thread_t * os_thread_get(Thread_t thread_id)
Expand Down
2 changes: 1 addition & 1 deletion src/os/kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static int do_set_timed_event(Txn_t txn, const unsigned slot, const unsigned int
sleeper->interval = interval;
sleeper->timer_type = type;

if (sleeper_queue[old_queue_offs].resume_time != next_resume || old_queue_offs == TIMER_INVALID_ID)
if (old_queue_offs == TIMER_INVALID_ID || sleeper_queue[old_queue_offs].resume_time != next_resume)
{
if (old_queue_offs != TIMER_INVALID_ID)
{
Expand Down
Loading