Skip to content

Commit 69e1586

Browse files
committed
remove tls
1 parent a97b12f commit 69e1586

File tree

9 files changed

+7
-412
lines changed

9 files changed

+7
-412
lines changed

include/libipc/tls_pointer.h

Lines changed: 0 additions & 112 deletions
This file was deleted.

src/ipc.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "libipc/ipc.h"
1414
#include "libipc/def.h"
1515
#include "libipc/shm.h"
16-
#include "libipc/tls_pointer.h"
1716
#include "libipc/pool_alloc.h"
1817
#include "libipc/queue.h"
1918
#include "libipc/policy.h"
@@ -253,19 +252,6 @@ struct conn_info_head {
253252
ipc::waiter cc_waiter_, wt_waiter_, rd_waiter_;
254253
ipc::shm::handle acc_h_;
255254

256-
/*
257-
* <Remarks> thread_local may have some bugs.
258-
*
259-
* <Reference>
260-
* - https://sourceforge.net/p/mingw-w64/bugs/727/
261-
* - https://sourceforge.net/p/mingw-w64/bugs/527/
262-
* - https://github.com/Alexpux/MINGW-packages/issues/2519
263-
* - https://github.com/ChaiScript/ChaiScript/issues/402
264-
* - https://developercommunity.visualstudio.com/content/problem/124121/thread-local-variables-fail-to-be-initialized-when.html
265-
* - https://software.intel.com/en-us/forums/intel-c-compiler/topic/684827
266-
*/
267-
ipc::tls::pointer<ipc::unordered_map<msg_id_t, cache_t>> recv_cache_;
268-
269255
conn_info_head(char const * name)
270256
: name_ {name}
271257
, cc_id_ {(cc_acc() == nullptr) ? 0 : cc_acc()->fetch_add(1, std::memory_order_relaxed)}
@@ -286,7 +272,8 @@ struct conn_info_head {
286272
}
287273

288274
auto& recv_cache() {
289-
return *recv_cache_.create_once();
275+
thread_local ipc::unordered_map<msg_id_t, cache_t> tls;
276+
return tls;
290277
}
291278
};
292279

src/libipc/memory/wrapper.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
#include "libipc/def.h"
1313
#include "libipc/rw_lock.h"
14-
#include "libipc/tls_pointer.h"
1514
#include "libipc/pool_alloc.h"
1615

1716
#include "libipc/utility/concept.h"
@@ -155,18 +154,16 @@ class async_wrapper {
155154
};
156155

157156
friend class alloc_proxy;
158-
159157
using ref_t = alloc_proxy&;
160-
using tls_t = tls::pointer<alloc_proxy>;
161158

162-
tls_t tls_;
163159
std::function<ref_t()> get_alloc_;
164160

165161
public:
166162
template <typename ... P>
167163
async_wrapper(P ... pars) {
168164
get_alloc_ = [this, pars ...]()->ref_t {
169-
return *tls_.create_once(this, pars ...);
165+
thread_local alloc_proxy tls(pars ...);
166+
return tls;
170167
};
171168
}
172169

src/libipc/platform/tls_detail_win.h

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/libipc/platform/tls_pointer_linux.h

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)