Fix global shutdown call from JSON API

This commit is contained in:
Gioacchino Mazzurco 2020-01-27 23:40:18 +01:00
parent 5dbbe1ffd7
commit 8c9310f754
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
2 changed files with 9 additions and 3 deletions

View file

@ -248,7 +248,13 @@ JsonApiServer::JsonApiServer(): configMutex("JsonApiServer config"),
{
INITIALIZE_API_CALL_JSON_CONTEXT;
DEFAULT_API_CALL_JSON_RETURN(rb::OK);
rsControl->rsGlobalShutDown();
/* Wrap inside RsThread::async because this call
* RsThread::fullstop() also on JSON API server thread.
* Calling RsThread::fullstop() from it's own thread should never
* happen and if it happens an error message is printed
* accordingly by RsThread::fullstop() */
RsThread::async([](){ rsControl->rsGlobalShutDown(); });
} );
}, true);