mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-07 01:06:45 +08:00
Update tls_pointer.h
This commit is contained in:
parent
bbefef4a37
commit
e87d516b1d
@ -29,15 +29,13 @@ IPC_EXPORT void* get(key_t key);
|
|||||||
/*
|
/*
|
||||||
* <Remarks>
|
* <Remarks>
|
||||||
*
|
*
|
||||||
* 1. In Windows, if you do not compile thread_local_ptr.cpp,
|
* You need to set the ipc::tls::pointer's storage manually:
|
||||||
* use thread_local_ptr will cause memory leaks.
|
|
||||||
*
|
|
||||||
* 2. You need to set the thread_local_ptr's storage manually:
|
|
||||||
* ```
|
* ```
|
||||||
* tls::pointer<int> p;
|
* tls::pointer<int> p;
|
||||||
* if (!p) p = new int(123);
|
* if (!p) p = new int(123);
|
||||||
* ```
|
* ```
|
||||||
* Just like an ordinary pointer. Or you could just call create:
|
* It would be like an ordinary pointer.
|
||||||
|
* Or you could just call create to 'new' this pointer automatically.
|
||||||
* ```
|
* ```
|
||||||
* tls::pointer<int> p;
|
* tls::pointer<int> p;
|
||||||
* p.create(123);
|
* p.create(123);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user