日期:2014-05-16  浏览次数:20696 次

程序不能后台运行
我编写了一个minigui应用程序,但是在目标板子上无法在后台运行,具体情况如下:
./gui & 程序可以启动,
但是在串口敲回车后出现命令行,
同时打印[1] + Stopped (tty input) ./gui
gui程序无反映,
ps显示:
 891 root 6080 T ./gui 
  892 root 6080 S ./gui 
  893 root 6080 T ./gui 
  894 root 6080 T ./gui 
  895 root 6080 T ./gui 
  896 root 6080 T ./gui 
  897 root 6080 T ./gui 
  898 root 636 R ps

另外:对这个程序ctrl + c 串口会打印乱码,

请高人指点,谢谢!!!!!!!!!!!!

------解决方案--------------------
看样是segment fault

------解决方案--------------------
GUI程序不应该读tty的啊!
"[1] + Stopped (tty input)", 是指程序试图从控制终端读, 但是由于在后台运行, 受到SIGTTIN信号而被停止:
man signal有下面的输出:
Perl code

     21    SIGTTIN      stop process         background read attempted from
                                             control terminal