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

Function device_destruct

TactilityKernel/source/device.cpp:71–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71error_t device_destruct(Device* device) {
72 lock_internal(device->internal);
73
74 auto* internal = device->internal;
75
76 if (internal->state.started || internal->state.added) {
77 unlock_internal(device->internal);
78 return ERROR_INVALID_STATE;
79 }
80 if (!internal->children.empty()) {
81 unlock_internal(device->internal);
82 return ERROR_INVALID_STATE;
83 }
84 LOG_D(TAG, "destruct %s", device->name);
85
86 device->internal = nullptr;
87 mutex_unlock(&internal->mutex);
88 delete internal;
89
90 return ERROR_NONE;
91}
92
93/** Add a child to the list of children */
94static void device_add_child(struct Device* device, struct Device* child) {

Callers 7

DeviceTest.cppFile · 0.85
stop_childFunction · 0.85
destroy_child_deviceFunction · 0.85
device_construct_addFunction · 0.85

Calls 1

mutex_unlockFunction · 0.85

Tested by

no test coverage detected