Commit e1886d04 authored by Jason Mercer's avatar Jason Mercer Committed by Ken Tossell
Browse files

Fixed locks so they stay in scope until end of method.

parent c8d1bf5c
...@@ -84,7 +84,7 @@ bool CameraDriver::Start() { ...@@ -84,7 +84,7 @@ bool CameraDriver::Start() {
} }
void CameraDriver::Stop() { void CameraDriver::Stop() {
boost::recursive_mutex::scoped_lock(mutex_); boost::recursive_mutex::scoped_lock lock(mutex_);
assert(state_ != kInitial); assert(state_ != kInitial);
...@@ -100,7 +100,7 @@ void CameraDriver::Stop() { ...@@ -100,7 +100,7 @@ void CameraDriver::Stop() {
} }
void CameraDriver::ReconfigureCallback(UVCCameraConfig &new_config, uint32_t level) { void CameraDriver::ReconfigureCallback(UVCCameraConfig &new_config, uint32_t level) {
boost::recursive_mutex::scoped_lock(mutex_); boost::recursive_mutex::scoped_lock lock(mutex_);
if ((level & kReconfigureClose) == kReconfigureClose) { if ((level & kReconfigureClose) == kReconfigureClose) {
if (state_ == kRunning) if (state_ == kRunning)
...@@ -167,7 +167,7 @@ void CameraDriver::ImageCallback(uvc_frame_t *frame) { ...@@ -167,7 +167,7 @@ void CameraDriver::ImageCallback(uvc_frame_t *frame) {
timestamp = ros::Time::now(); timestamp = ros::Time::now();
} }
boost::recursive_mutex::scoped_lock(mutex_); boost::recursive_mutex::scoped_lock lock(mutex_);
assert(state_ == kRunning); assert(state_ == kRunning);
assert(rgb_frame_); assert(rgb_frame_);
...@@ -247,7 +247,7 @@ void CameraDriver::AutoControlsCallback( ...@@ -247,7 +247,7 @@ void CameraDriver::AutoControlsCallback(
int selector, int selector,
enum uvc_status_attribute status_attribute, enum uvc_status_attribute status_attribute,
void *data, size_t data_len) { void *data, size_t data_len) {
boost::recursive_mutex::scoped_lock(mutex_); boost::recursive_mutex::scoped_lock lock(mutex_);
printf("Controls callback. class: %d, event: %d, selector: %d, attr: %d, data_len: %zu\n", printf("Controls callback. class: %d, event: %d, selector: %d, attr: %d, data_len: %zu\n",
status_class, event, selector, status_attribute, data_len); status_class, event, selector, status_attribute, data_len);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment