I'm trying to use threads on a Windows C program, compiled on an Eclipse environment and Mingw.
I've also put -lpthread and -pthread on the compilation command, and included on the program.
I made calls to pthread_create(), pthread_cancel() and pthread_exit() where appropriate on my logic.
It always works as intended, but that my program ends saying
This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
Any hints? Am I missing something?
Update
Global variable:
pthread_t thr;
Inside the start function:
pthread_create(&thr,NULL,ThrFunc,NULL);
pthread_join(thr,NULL);
Inside ThrFunc:
while (TRUE)
{
// do something
if (some other thing occurs)
pthread_exit();
}