2

My intention is to create a tfgets function. tfgets is similar to fget except that it has a time out of 1 sec. If no input is received in 1 sec, then the program returns NULL. Otherwise, it returns whatever fgets returns.

How can I create a good design for tfgets?

NOTE: for those of you who will ask "what did you try?". Here is my first attempt using kill. But it apparently brings some strange system instability in ubuntu 14.04. Why can't the signal handler in the child process be triggered?

drdot
  • 3,215
  • 9
  • 46
  • 81
  • The "strange instability" is likely a problem in your code or perhaps the way you are running it. You would be better served trying to solve that rather than asking this new broad question. Show your exact updated code and describe what behaviour you observe. – kaylum Jun 04 '17 at 04:06
  • I will add, https://stackoverflow.com/q/2917881/7076153 to duplicates. – Stargateur Jun 04 '17 at 04:12
  • Thank you for the pointers! – drdot Jun 04 '17 at 04:14

0 Answers0