JSON API service and RsThread fixups

This commit is contained in:
Gioacchino Mazzurco 2020-01-08 14:24:46 +01:00
parent f4d7fe4dde
commit f12ec2b535
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
6 changed files with 88 additions and 53 deletions

View file

@ -63,10 +63,13 @@ public:
std::vector<std::shared_ptr<rb::Resource>> getResources() const;
/// @see RsJsonApi
bool restart() override;
void fullstop() override { RsThread::fullstop(); }
/// @see RsJsonApi
bool fullstop() override;
void restart() override;
/// @see RsJsonApi
void askForStop() override { RsThread::askForStop(); }
/// @see RsJsonApi
inline bool isRunning() override { return RsThread::isRunning(); }
@ -193,6 +196,10 @@ private:
std::less<const JsonApiResourceProvider> > mResourceProviders;
std::shared_ptr<restbed::Service> mService;
/** Protect service only during very critical operation like resetting the
* pointer, still not 100% thread safe, but hopefully we can avoid
* crashes/freeze with this */
RsMutex mServiceMutex;
uint16_t mListeningPort;
std::string mBindingAddress;