- Mar 8, 2003
- 38,416
- 4
- 0
Hey,
I am trying to launch an external program to capture its (debug) output to a textfile.
What I have tried is assigning it to a thread and then trying to kill the thread, but it does not kill the application. For example (having omitted the program that I am intending to run and just using gedit with no debug output capturing):
Prototype / imports:
code to create child thread and then kill it after a delay:
the process's function:
Any thoughts on how I can launch an external program on another thread, let it execute for a shortwhile, then kill that thread with the parent thread other than this (since gedit in this case remains open)?
Thanks
I am trying to launch an external program to capture its (debug) output to a textfile.
What I have tried is assigning it to a thread and then trying to kill the thread, but it does not kill the application. For example (having omitted the program that I am intending to run and just using gedit with no debug output capturing):
Prototype / imports:
#include <pthread.h>
#include <sys/signal.h>
void *executeApp(void *);
code to create child thread and then kill it after a delay:
pthread_t cTid;
pthread_create(&cTid, NULL, executeApp, NULL);
sleep(5);
pthread_kill(cTid, SIGALRM);
the process's function:
void *executeApp(void *){
int returnValue = system("gedit");
}
Any thoughts on how I can launch an external program on another thread, let it execute for a shortwhile, then kill that thread with the parent thread other than this (since gedit in this case remains open)?
Thanks