You might try changing that raise(SIGSTOP) in terminal_thread() to kill(getpid(), SIGSTOP). You want to stop the entire process, not just the terminal thread.
Prior to that commit, each thread that received SIGTSTP would be stopped. After the commit, only the terminal thread will be stopped. - todd