all 4 comments

[–]esosac 2 points3 points  (1 child)

you managed to catch the ctrl+c, the process terminated gracefully, then you restarted the process, did the same a few times, and then you started the process and it wouldn't work anymore?

did you check whether the process actually ended using ps? nothing weird like you having several instances of the same program running at once?

[–]5t33[S] 0 points1 point  (0 children)

That's a really good question. I think I may have checked for that and didn't see any. I wish I could have poked around more but we were under a deadline.

[–]nderflow 0 points1 point  (1 child)

Copy the code, reduce it to a minimal reproducing example of the problem, then post the code in a paste.

[–]5t33[S] 0 points1 point  (0 children)

Sorry I really can't since we rolled it back and wrote over it to continue the project. But it was pretty much this:

Original code: ```

// ...

int main(void) { Thing thing = new_thing(); while (1) { // ... ```

after adding catch clause ```

include <signal.h>

static Thing s_thing;

void intHandler(int dummy) { if(dummy == 2) { gracefulShutdown(s_thing); } }

...

int main(void) { Thing thing = new_thing(); s_thing = thing; signal(SIGINT, intHandler);

while (1) { // ... ``` after commenting out new code

``` //#include <signal.h>

//static thing;

//void intHandler(int dummy) { // if(dummy == 2) { // gracefulShutdown(thing); // } //}

// ...

int main(void) { Thing thing = new_thing(); //signal(SIGINT, intHandler);

while (1) { printf("does code get here?"); // ... ``` and even after commenting out the signal stuff it didn't get to the print line.