Question: I wanted to create something simple like void Function(struct str) to calculate paralel in barriers sync, but seems to not be so simple, so I followed this:
<https://learn.microsoft.com/en-us/windows/win32/procthread/creating-threads>
and some other topics, but without success. Couldnt find a solution. Code is all in one file.

Any advise how to fix it? make it work?

**Solved by std::thread rewrite**

[![Printscreened code, due to unknow issue putting in here... -_-](https://i.stack.imgur.com/AzkTH.png)](https://i.stack.imgur.com/AzkTH.png)

Answer: 
Note how when you cast `lpParam` to a `dectectorData*` you should cast like this: `(detectorData*)lpParam` not `(detectorData)lpParam`. (Note the `*` denoting a pointer.)
Since I am using C++, there is already std::thread class.
So my simple task can be done by this code:

```
void detAndComputeT(detectorData &data) {
Ptr<SIFT> detector = cv::SIFT::create();
detector->detectAndCompute(data.image, Mat(), data.keypoints, data.descriptors);
}

```

and

```
std::thread threads2[2];
detectorData dataImage1;
detectorData dataImage2;
dataImage1.image = image1_toCalc;
dataImage2.image = image2_toCalc;
threads2[0] = thread(detAndComputeT, std::ref(dataImage1));
threads2[1] = thread(detAndComputeT, std::ref(dataImage2));
threads2[0].join();
threads2[1].join();

```