Changeset ba25c4b in mainline for kernel/generic/src/time/clock.c


Ignore:
Timestamp:
2023-02-09T15:31:39Z (22 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
83789ea2
Parents:
78acbc72
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-09 15:28:13)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-09 15:31:39)
Message:

Synchronize timeout_unregister() with handler execution

This ensures that when timeout_unregister() returns,
timeout handler either didn't run at all, or it ran to
completion and is no longer executing.

This will be handy a few patches later.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/time/clock.c

    r78acbc72 rba25c4b  
    168168                timeout_handler_t handler = timeout->handler;
    169169                void *arg = timeout->arg;
     170                atomic_bool *finished = &timeout->finished;
    170171
    171172                irq_spinlock_unlock(&CPU->timeoutlock, false);
    172173
    173174                handler(arg);
     175
     176                /* Signal that the handler is finished. */
     177                atomic_store_explicit(finished, true, memory_order_release);
    174178
    175179                irq_spinlock_lock(&CPU->timeoutlock, false);
Note: See TracChangeset for help on using the changeset viewer.