2 * Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de.
3 * Distributed under the terms of the MIT License.
7 #include "ICUThreadLocalStorageValue.h"
11 #include <unicode/ucnv.h>
18 ICUThreadLocalStorageValue::ICUThreadLocalStorageValue()
25 ICUThreadLocalStorageValue::~ICUThreadLocalStorageValue()
27 if (converter
!= NULL
)
28 ucnv_close(converter
);
33 ICUThreadLocalStorageValue::GetInstanceForKey(pthread_key_t tlsKey
,
34 ICUThreadLocalStorageValue
*& instanceOut
)
36 ICUThreadLocalStorageValue
* tlsValue
= NULL
;
37 void* value
= pthread_getspecific(tlsKey
);
39 tlsValue
= new (std::nothrow
) ICUThreadLocalStorageValue();
42 pthread_setspecific(tlsKey
, tlsValue
);
44 tlsValue
= static_cast<ICUThreadLocalStorageValue
*>(value
);
46 instanceOut
= tlsValue
;
52 } // namespace Libroot
53 } // namespace BPrivate