Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Reorg magic#80

Merged
pprindeville merged 3 commits intokravietz:masterfrom
pprindeville:reorg-magic
Dec 21, 2016
Merged

Reorg magic#80
pprindeville merged 3 commits intokravietz:masterfrom
pprindeville:reorg-magic

Conversation

@pprindeville
Copy link
Collaborator

Isolate all platform dependencies into magic.c.

Use constructor notation to cause magic to be self-initializing.

Remove dependency on pthreads.

This PR should go in before PR #72 or PR #78.

The pseudo-random number function magic() needs to be primed via
magic_init() before being invoked.  The standard (but klunky) way
of handling this is with a static bool inside the function which
indicates whether initialization has happened, and if not, handles
initialization and then sets the flag.

Sometimes it's more desireable to have initialization happen in
a known order before program execution starts (this helps with
reproducibility).  We can do this by indicating to the compiler/
linker that particular functions need to be executed after __start()
but before main().
@pprindeville pprindeville merged commit 773a1ca into kravietz:master Dec 21, 2016
@pprindeville pprindeville deleted the reorg-magic branch December 21, 2016 02:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant