Update tls_pointer.h

This commit is contained in:
木头云 2020-03-20 12:20:28 +08:00 committed by GitHub
parent bbefef4a37
commit e87d516b1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);