LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-09-2014, 12:48 AM   #1
arunishad
LQ Newbie
 
Registered: Jun 2014
Posts: 1

Rep: Reputation: Disabled
SIGSTOP/SIGCONT is not working with any getchar or read ...


1) Compile and start a prog
2) Press enter to print 'Hello'
3) send kill -19 <pid> // SIGSTOP
4) send kill -18 <pid> // SIGCONT

Prob: it will not resume, (I don't want to use 'fg')

Pleas help.

/* START */
#include<stdio.h>
#include<stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>

void my_handle(int sig) {

printf("Do Nothing\n");
}

int main() {

printf("my pid = %d\n", getpid());
signal(SIGCONT, my_handle);

while(1) {
printf("Hello\n");
getchar();
//sleep(1);
}

return 0;
}

/* END */
 
Old 06-12-2014, 09:29 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
I suspect it resumes but getchar() won't work until you do fg.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sigcont handler is not getting called pro_learner Linux - Newbie 2 03-13-2013 12:59 PM
Signal SIGSTOP being ignored - why? bjdea1 Programming 6 06-27-2007 09:48 AM
using SIGSTOP and SIGCONT Wazzz Programming 0 12-12-2006 01:50 AM
getchar() problem. Read other threads. jstephens84 Programming 3 11-20-2005 04:10 PM
getchar() not working? lackluster Programming 3 06-24-2002 08:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration