[
https://issues.apache.org/jira/browse/MYNEWT-491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15710248#comment-15710248
]
ASF subversion and git services commented on MYNEWT-491:
--------------------------------------------------------
Commit 259c670486422dd9beb891d403e700af08189eb6 in incubator-mynewt-core's
branch refs/heads/develop from [~ccollins476]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-mynewt-core.git;h=259c670
]
MYNEWT-491 Prevent repeated package initialization
A function can ensure it only gets called during system initialization
by invoking the SYSINIT_ASSERT_ACTIVE() macro. If the function gets
called outside of sysinit, a failed assert is triggered.
> Double calling init functions should be disallowed
> --------------------------------------------------
>
> Key: MYNEWT-491
> URL: https://issues.apache.org/jira/browse/MYNEWT-491
> Project: Mynewt
> Issue Type: Improvement
> Components: Sysinit
> Affects Versions: v1_0_0_beta1
> Reporter: Sterling Hughes
> Assignee: Christopher Collins
> Fix For: v1_0_0_rel
>
>
> When "init" functions are specified to sysinit, that should be the only place
> they are called. They should not be directly called, or bad things happen.
> There should be a macro SYSINIT_ASSERT_CALLED_ONCE() (name it better), at the
> beginning of these init functions, that asserts on double init. It can be
> hard to debug when this function is called twice, and I think it will be very
> common for users to not notice the init function exported by the package, and
> instead call it directly, so we should find helpful ways to inform them (at
> least when build_profile=debug).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)