Skip to content
Permalink
Browse files

kernel/mempool: Fix ticks/ms confusion

The mempool blocking implementation was mixing tick and millisecond
APIs.  Get it right.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
  • Loading branch information...
andyross authored and nashif committed Jun 17, 2019
1 parent ee4c23c commit 905209ba7d0880e65dc70cdd47ec2575dd72e9b2
Showing with 3 additions and 4 deletions.
  1. +3 −4 kernel/mempool.c
@@ -55,7 +55,7 @@ int k_mem_pool_alloc(struct k_mem_pool *p, struct k_mem_block *block,
__ASSERT(!(z_is_in_isr() && timeout != K_NO_WAIT), "");

if (timeout > 0) {
end = z_tick_get() + z_ms_to_ticks(timeout);
end = k_uptime_get() + timeout;
}

while (true) {
@@ -93,9 +93,8 @@ int k_mem_pool_alloc(struct k_mem_pool *p, struct k_mem_block *block,
z_pend_curr_unlocked(&p->wait_q, timeout);

if (timeout != K_FOREVER) {
timeout = end - z_tick_get();

if (timeout < 0) {
timeout = end - k_uptime_get();
if (timeout <= 0) {
break;
}
}

0 comments on commit 905209b

Please sign in to comment.
You can’t perform that action at this time.