|
Back
Midas
Rome
Roody
Rootana
|
Midas DAQ System |
Not logged in |
|
|
12 Dec 2012, Shaun Mead, Bug Report, ss_thread_kill() kills entire program
|
13 Dec 2012, Stefan Ritt, Bug Report, ss_thread_kill() kills entire program
|
13 Dec 2012, Konstantin Olchanski, Bug Report, ss_thread_kill() kills entire program
|
13 Dec 2012, Shaun Mead, Bug Report, ss_thread_kill() kills entire program
|
|
Message ID: 842
Entry time: 13 Dec 2012
In reply to: 841
|
Author: |
Stefan Ritt |
Topic: |
Bug Report |
Subject: |
ss_thread_kill() kills entire program |
|
|
The Linux thread functionality was introduced by Konstantin, so he might have a better idea about that.
What I usually do is a graceful thread shutdown just by a flag. Like
int stop_thread = 0;
INT f(void *param)
{
for (int x = 0; x < 100; x++) {
sleep(1);
if (stop_thread) {
// clean up things here...
return 0;
}
}
return 0;
}
int main()
{
printf("creating thread\n");
midas_thread_t thr = ss_thread_create(f, NULL);
sleep(2);
printf("killing thread\n");
stop_thread = 1;
sleep(2);
printf("success\n");
return 0;
}
This way I have a chance to clean up things in the thread, which otherwise I would not be able to. |