Bug #1219
Process is not interrupted by ctrl-c with long usleep in while(!gShouldStop)
Status: | Closed | Start date: | 2015-05-12 | |
---|---|---|---|---|
Priority: | Low | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | - | |||
Target version: | - |
Description
When there is a while(!gShouldStop) containing a usleep(>1000000) the program cannot be terminated with a ctrl-c.
Try to place this code in PRU::loop()
before while (!gShouldStop):
while(!gShouldStop){
printf("new buffer\ndac adc\n");
for(unsigned int n = 0; n<digital_buffer_frames; n++){
for(unsigned int n=0; n<digital_buffer_frames ; n++){
printf("%3d ",digitalBuffer0[n]);
printf("%3d ",digitalBuffer1[n]);
printf("%3d ",digitalBuffer1[n+MEM_DIGITAL_BUFFER1_OFFSET/sizeof(uint32_t)]);
if((n&7)==7)
printf("\n");
}
printf("\n");
usleep(1000000);
}
}
Run the program and press ctrl-c. The program will not die and you need to use
pkill BeagleRT
to terminate it
History
#1 Updated by Giulio Moro over 8 years ago
This occasionally happens with usleep times as small as 10000us!
#2 Updated by Giulio Moro almost 8 years ago
Must be because of the timeout in main:
79 while(!gShouldStop) { 80 usleep(100000); 81 }
#3 Updated by Giulio Moro almost 8 years ago
- Status changed from New to Closed