[riot-devel] To global seed or not to global seed

Oleg Hahm oliver.hahm at inria.fr
Wed Mar 8 10:21:15 CET 2017


Dear Cenk,

thanks for bringing up this discussion.

On Wed, Mar 08, 2017 at 12:18:28AM +0100, Cenk Gündoğan wrote:
 
> 1) we can define it as BCP to *not* use `random_init()` if `auto_init`
>    is used
>    => it's hard to guarantee a one-time call to `random_init()` as human
>    do surely err (especially if several nested modules are involved).

Basically, we have similar problems for other modules that should (or even
must) not be initialized twice. So far, my/our take on this was to document
this rather than programmatically prevent this. The memory overhead is small,
but existent, the runtime overhead is probably negligible for a function that
should not be called more than once.

> In contrast to the current procedure of having a global state, we rather
> should opt to allow local states for each thread (not excluding a global
> state).

Is testing and simulation the only use case you can imagine? I'm somewhat
reluctant to add code just for non-production purposes.

Cheers,
Oleg
-- 
/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
 *
 * Wirzenius wrote this portably, Torvalds fucked it up :-)
 */
        linux-2.2.16/lib/vsprintf.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20170308/394fa25e/attachment.sig>


More information about the devel mailing list