MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / addService

Function addService

Tactility/Source/service/ServiceRegistration.cpp:23–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21static Mutex instance_mutex;
22
23void addService(std::shared_ptr<const ServiceManifest> manifest, bool autoStart) {
24 assert(manifest != nullptr);
25 // We'll move the manifest pointer, but we'll need to id later
26 const auto& id = manifest->id;
27
28 LOGGER.info("Adding {}", id);
29
30 manifest_mutex.lock();
31 if (service_manifest_map[id] == nullptr) {
32 service_manifest_map[id] = std::move(manifest);
33 } else {
34 LOGGER.error("Service id in use: {}", id);
35 }
36 manifest_mutex.unlock();
37
38 if (autoStart) {
39 startService(id);
40 }
41}
42
43void addService(const ServiceManifest& manifest, bool autoStart) {
44 addService(std::make_shared<const ServiceManifest>(manifest), autoStart);

Calls 5

startServiceFunction · 0.85
infoMethod · 0.80
errorMethod · 0.80
lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected