Trying to use Threads on the Jetson TK1

Hi everyone,

I hope this is the right forum to ask:

I’m trying to make a program that can detect multiple items with a video camera.
I created few separate algorithms and I want to run them concurrently on different threads.
(obviously I’m using OpenCV libraries)

this is the function that suppose to initialize the threads:

#include <thread>

Class A
{
private:
	cv::VideoCapture Cap;
	std::thread detections[N];
public:
        template <class T>
	void initDetection(T* dtct,IDX i)
	 {
	 	if (dtct != NULL)
	 	{
			if (Cap.isOpened())
	 		{
[b]				detections[i] = thread([&] {dtct->Detect(Cap);});
[/b]				if (detections[i].joinable())
					cout << typeid(*dtct).name() + 6 << " Detection initialized" << endl;
	 		}
	 	}
	 }
 };

Class B
{
publie:
     virtual void Detect(cv::VideoCapture& Cap){....}
};

basically what I’m trying to do is run the function Detect for a different class that have that function.

The code above gives me the error:
“HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CORP
Segmentation fault”

however, when calling the function Detect without a thread, like:

void main()
{
...
B b;
b.Detect(Cap);
}

its working.

even though it shows “HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CORP”

I don’t mind the “HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CORP” as long as it works (couldn’t get rid of it anyway) but I really need this to work on the threads (trying to work 4 different threads but the error remains even with one)

for now, I want to use the CPU and not use CUDA.
advice anyone?