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


Ignore:
Timestamp:
2022-08-15T16:31:58Z (21 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
46b305a
Parents:
742f95ec
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2022-08-15 16:26:16)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2022-08-15 16:31:58)
Message:

Make timeout→cpu immutable

We ensure timeout→cpu is only changed in timeout_register(),
which by its nature is externally synchronized with timeout_unregister(),
and internally synchronized with clock(). Thus in both those contexts,
timeout→cpu is always a valid constant pointing to the CPU of last
call to timeout_register().

Doing so removes the need for synchronization using timeout→lock.
Instead, timeout→link is synchronized by timeout→cpu→timeoutlock,
and all other fields of timeout_t are also immutable outside
timeout_register(), which means they are safely synchronized by
a combination of timeout→cpu→timoutlock and external sychronization
of timeout_register/unregister.

File:
1 edited

Legend:

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

    r742f95ec rad58fd2  
    172172                        timeout_handler_t handler = timeout->handler;
    173173                        void *arg = timeout->arg;
    174                         timeout_reinitialize(timeout);
    175174
    176175                        irq_spinlock_unlock(&timeout->lock, false);
Note: See TracChangeset for help on using the changeset viewer.