EDIT: It appears to be a problem with my computer's setup. Running it on another computer worked just fine.
Basically, when I tried to debug my code in gdb, something caused the two lines to repeat twice without any notifications that threads are being switched. Those are two simple lines, not wrapped in any loops. Are there any hint on what may be causing this to happen?
//gdb session
170 int signum = curr->num;
(gdb) n
171 signal_handler handler = kthread->userContext->handlers[signum - 1];
(gdb) n
170 int signum = curr->num;
(gdb) n
171 signal_handler handler = kthread->userContext->handlers[signum - 1];
(gdb) n
//Actual Code, not in loops
int signum = curr->num;
signal_handler handler = kthread->userContext->handlers[signum - 1];