Skip to content

Commit d9335a0

Browse files
committed
fix session begin flow if automatic session = true
1 parent 3e7f86a commit d9335a0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/countly.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,19 +202,21 @@ void Countly::start(const std::string& app_key, const std::string& host, int por
202202
}
203203

204204
if (!running) {
205+
206+
mutex.unlock();
207+
beginSession();
208+
mutex.lock();
209+
205210
if (start_thread) {
206211
stop_thread = false;
212+
207213
try {
208214
thread = new std::thread(&Countly::updateLoop, this);
209215
} catch(const std::system_error& e) {
210216
std::ostringstream log_message;
211217
log_message << "Could not create thread: " << e.what();
212218
log(Countly::LogLevel::FATAL, log_message.str());
213219
}
214-
} else {
215-
mutex.unlock();
216-
beginSession();
217-
mutex.lock();
218220
}
219221
}
220222
mutex.unlock();

0 commit comments

Comments
 (0)