Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#31 TLSSlot should explicitly default-construct _value

closed
nobody
5
2012-09-14
2006-09-05
Caleb Epstein
No

The initial value stored in TLSSlot is not being
explicitly default-constructed. This leads to garbage
values coming from a variable of type e.g.
ThreadLocal<int> because the value has not been
initialized. I needed to provide a wrapper class to
get predictable results.

Since the value held in the TLSSlot must be default
constructible anyway, how about making the TLSSlot ctor
just do:

00068 TLSSlot()
NEW : _value()
00069 {
00070 }

so that ThreadLocal<T> works as expected with primitive
types.

Discussion

  • Logged In: YES
    user_id=1148207

    fixed in 1.2.3