I'm new to threads handling and I'm getting a bit confused as of why this bit of code doesn't work :
// Note that the GKITH object is useful for my whole code
void thread_function( gkit2light_Handler*& GKITH )
{
std::cout << "\t~ Writing from gkit2light thread..." << std::endl;
}
int main( int argc, char** argv )
{
// Custom gkit2light Handler
gkit2light_Handler *gkit_handler = new gkit2light_Handler( );
// Launching thread...
std::thread gkit_thread( thread_function, gkit_handler );
return 0;
}
I run it under macOS 10.13 using XCode 9. None of these lines actually throws me an error but my compiler gives me this message : « Attempt to use a deleted function ». This is weird because here the thread_function( ) only accesses the stdout...
Here it the deleted function, maybe this can help you !
struct __nat
{
#ifndef _LIBCPP_CXX03_LANG
// ...
// This is the destructor that is throwing the error
~__nat() = delete;
#endif
};
Here is a screenshot of the error (there isn't any more info): XCode compiler error screenshot