Revision 6d61d510 src/raft/ReplicaManager.cc
src/raft/ReplicaManager.cc | ||
---|---|---|
60 | 60 |
{ |
61 | 61 |
it->second->finalize(); |
62 | 62 |
|
63 |
pthread_join(it->second->thread_id(), 0); |
|
64 |
|
|
65 | 63 |
delete it->second; |
66 | 64 |
} |
67 | 65 |
|
... | ... | |
98 | 96 |
|
99 | 97 |
void ReplicaManager::delete_replica_thread(int follower_id) |
100 | 98 |
{ |
101 |
std::ostringstream oss; |
|
102 | 99 |
|
103 | 100 |
std::map<int, ReplicaThread *>::iterator it; |
104 | 101 |
|
... | ... | |
109 | 106 |
return; |
110 | 107 |
} |
111 | 108 |
|
112 |
oss << "Stopping replication thread for follower: " << follower_id; |
|
113 |
|
|
114 |
NebulaLog::log("RCM", Log::INFO, oss); |
|
115 |
|
|
116 | 109 |
it->second->finalize(); |
117 | 110 |
|
118 |
pthread_join(it->second->thread_id(), 0); |
|
119 |
|
|
120 | 111 |
NebulaLog::log("RCM", Log::INFO, "Replication thread stopped"); |
121 | 112 |
|
122 | 113 |
delete it->second; |
... | ... | |
129 | 120 |
|
130 | 121 |
void ReplicaManager::add_replica_thread(int follower_id) |
131 | 122 |
{ |
132 |
std::ostringstream oss; |
|
133 |
|
|
134 | 123 |
pthread_attr_t pattr; |
135 | 124 |
pthread_t thid; |
136 | 125 |
|
... | ... | |
147 | 136 |
thread_pool.insert(std::make_pair(follower_id, rthread)); |
148 | 137 |
|
149 | 138 |
pthread_attr_init (&pattr); |
150 |
pthread_attr_setdetachstate(&pattr, PTHREAD_CREATE_JOINABLE); |
|
151 |
|
|
152 |
oss << "Starting replication thread for follower: " << follower_id; |
|
153 |
|
|
154 |
NebulaLog::log("RCM", Log::INFO, oss); |
|
139 |
pthread_attr_setdetachstate(&pattr, PTHREAD_CREATE_DETACHED); |
|
155 | 140 |
|
156 | 141 |
pthread_create(&thid, &pattr, replication_thread, (void *) rthread); |
157 | 142 |
|
Also available in: Unified diff