Skip to content

Commit

Permalink
T265 fix for race condition during pipeline stop.
Browse files Browse the repository at this point in the history
This PR is effectively the suggested fix in the GH issue below. Thank you @ankyur.
  
IntelRealSense#7276 

I've validated the fix works using the following code:

// Reproduces T265 Hand on Exit.
int main(int, char**)
{
	constexpr std::chrono::seconds timeout{ 1 };

	while (true)
	{
		// Start
		rs2::config config;
		rs2::pipeline pipeline;

		std::cout << "Entering pipeline.start()" << std::endl;
		pipeline.start();
		std::cout << "Exiting pipeline.start()" << std::endl;

		std::cout << "Sleeping for 1 second..." << std::endl;
		std::this_thread::sleep_for(timeout);
		
		std::cout << "Entering pipeline.stop()" << std::endl;
		pipeline.stop();
		std::cout << "Exiting pipeline.stop()" << std::endl;
	}

	return 0;
}

Suspect this fix potentially addresses the following open T265 issues as well:

IntelRealSense#7553
IntelRealSense#5807
IntelRealSense#6272
IntelRealSense#7555
IntelRealSense#7750
  • Loading branch information
krazycoder2k authored Mar 12, 2021
1 parent 77fce15 commit c67522b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tm2/tm-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1326,8 +1326,8 @@ namespace librealsense
void tm2_sensor::stop_interrupt()
{
if (_interrupt_request) {
_interrupt_callback->cancel();
if (_device->cancel_request(_interrupt_request)) {
_interrupt_callback->cancel();
_interrupt_request.reset();
}
}
Expand Down Expand Up @@ -1387,8 +1387,8 @@ namespace librealsense
void tm2_sensor::stop_stream()
{
if (_stream_request) {
_stream_callback->cancel();
if (_device->cancel_request(_stream_request)) {
_stream_callback->cancel();
_stream_request.reset();
}
}
Expand Down

0 comments on commit c67522b

Please sign in to comment.