r/linux_programming • u/promach • Jun 04 '18
forked processes finish sequence dilemma
/r/cpp_questions/comments/8oegn3/forked_processes_finish_sequence_dilemma/
2
Upvotes
r/linux_programming • u/promach • Jun 04 '18
View all comments
Show parent comment
2
u/[deleted] Jun 05 '18
In C and C++, the name of an array decays to a pointer to its first member. What that means is if a function takes a pointer to something and you pass it an named array of the something, it is exactly as if you passed it a pointer to the first member of that array. On line 437, std::thread's constructor you are using takes a callable object as its first argument and the arguments to that object as subsequent arguments. You passed in a function,
write_thread, that takes a pointer to aMatas its argument. But then you passed in the address ofrgbchannelas the argument, which is itself an array ofMat. So instead of pointer to aMat, it's a pointer to an array ofMat. If you meant to pass a pointer to the first element of the array, passingrgbchannelitself I believe should work. Not sure if this solves the problem but that's what I can see right now.