Merge "storaged:Thread out of sync will cause null pointer crash" am: 2929ab63e3

Change-Id: I643b5246b809f72a8cf0b3c7013c40941b8d45ad
This commit is contained in:
Automerger Merge Worker 2020-02-12 02:17:52 +00:00
commit 38669ed46d

View file

@ -46,11 +46,6 @@ sp<storaged_t> storaged_sp;
// Function of storaged's main thread
void* storaged_main(void* /* unused */) {
storaged_sp = new storaged_t();
storaged_sp->init();
storaged_sp->report_storage_info();
LOG(INFO) << "storaged: Start";
for (;;) {
@ -123,6 +118,9 @@ int main(int argc, char** argv) {
if (flag_main_service) { // start main thread
// Start the main thread of storaged
storaged_sp = new storaged_t();
storaged_sp->init();
storaged_sp->report_storage_info();
pthread_t storaged_main_thread;
errno = pthread_create(&storaged_main_thread, NULL, storaged_main, NULL);
if (errno != 0) {