Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit b6c0024

Browse files
committed
Merge branch 'tianyuli-rpc' into tianyuli-libpqxx
* tianyuli-rpc: Move function definition back because of templates Update dedicated_thread_registry.cpp Fix compilation issue # Conflicts: # src/common/dedicated_thread_registry.cpp # src/include/common/dedicated_thread_registry.h
2 parents d895633 + 30fcd2b commit b6c0024

File tree

2 files changed

+16
-38
lines changed

2 files changed

+16
-38
lines changed

src/common/dedicated_thread_registry.cpp

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

src/include/common/dedicated_thread_registry.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <thread>
1818
#include "common/macros.h"
1919
#include "common/dedicated_thread_task.h"
20-
#include "common/dedicated_thread_owner.h"
2120

2221
namespace peloton {
2322

@@ -31,10 +30,24 @@ class DedicatedThreadRegistry {
3130
public:
3231
DedicatedThreadRegistry() = default;
3332

34-
~DedicatedThreadRegistry();
33+
~DedicatedThreadRegistry() {
34+
// Note that if registry is shutting down, it doesn't matter whether
35+
// owners are notified as this class should have the same life cycle
36+
// as the entire peloton process.
37+
38+
for (auto &entry : thread_owners_table_) {
39+
for (auto &task : entry.second) {
40+
task->Terminate();
41+
threads_table_[task.get()].join();
42+
}
43+
}
44+
}
3545

3646
// TODO(tianyu): Remove when we remove singletons
37-
static DedicatedThreadRegistry &GetInstance();
47+
static DedicatedThreadRegistry &GetInstance() {
48+
static DedicatedThreadRegistry registry;
49+
return registry;
50+
}
3851

3952
/**
4053
*

0 commit comments

Comments
 (0)