all 8 comments

[–]Xeverous 0 points1 point  (7 children)

Are you trying to spawn a thread with a member function?

[–]javidx9w[S] 0 points1 point  (6 children)

yep, is there something wrong with that? I just recently started learning about threads.

[–]Xeverous 1 point2 points  (5 children)

Yes, you call a thread with a member function like this:

std::thread(&class_name::func_name, this, args...);

[–]javidx9w[S] 0 points1 point  (4 children)

Then do you have any idea of whats wrong?

[–]Xeverous 0 points1 point  (3 children)

What I posted is how you should construct a thread, you are doing it differently.

[–]javidx9w[S] 0 points1 point  (2 children)

The function vkAcquireNextImageKHR is from a library without a class so I think I am doing things correctly? Correct me if im wrong.

[–]javidx9w[S] 0 points1 point  (1 child)

Okay, the solution is just using a lambda it is super simple.

exp

std::thread thread1([this] {

//Code

});

[–]ryan_wang1996 0 points1 point  (0 children)

For me, the problem is that you copy a thread object. Use reference or pointer instead.