]> git.lizzy.rs Git - rust.git/commit
Make sentinel value configurable
authorFlorian Bartels <Florian.Bartels@elektrobit.com>
Tue, 6 Dec 2022 08:32:11 +0000 (09:32 +0100)
committerFlorian Bartels <Florian.Bartels@elektrobit.com>
Tue, 6 Dec 2022 08:38:09 +0000 (09:38 +0100)
commit980065ab23650452c33bb47ef66d75fbfbcb6e04
treef3d46669b7c256204f7095bb41f1a842b0c10666
parented61c139c2bc778ebb91f5dd6a5393aa20467f78
Make sentinel value configurable

There are OSs that always return the lowest free value.
The algorithm in `lazy_init` always avoids keys with the
sentinel value.
In affected OSs, this means that each call to `lazy_init`
will always request two keys from the OS and returns/frees
the first one (with sentinel value) immediately afterwards.

By making the sentinel value configurable, affected OSs can
use a different value than zero to prevent this performance
issue.
library/std/src/sys_common/thread_local_key.rs