Here is a small sample of what I am doing without much of the logic.. basically the threading part. Could someone tell me if this is memory leak free?
If it is not, what could I do to make it memory leak free.
Thanks,
Code:
pthread_mutex_t hMutex = PTHREAD_MUTEX_INITIALIZER;
void SendFile()
{
if ( pthread_mutex_lock( &hMutex ) != 0 )
cout << "Error locking mutex" << endl;
/* Some Code... */
if ( pthread_mutex_unlock( &hMutex ) != 0 )
cout << "Error unlocking mutex" << endl;
pthread_exit( NULL );
}
void Run()
{
/*Some Code....*/
pthread_t uploadThread = {0};
if( pthread_create( &uploadThread, NULL, (void*(*)(void*))SendFile, NULL ) != 0 )
cout << "Error creating thread" << endl;
}
int main()
{
Run();
pthread_mutex_destroy( &hMutex );
return 0;
}