From: Silambu Chelvan <silambu_mdu@yahoo.com>
To: linux-newbie@vger.kernel.org
Subject: Re: Switching between foreground and background
Date: Mon, 22 Sep 2003 05:38:22 -0700 (PDT) [thread overview]
Message-ID: <20030922123822.71099.qmail@web20003.mail.yahoo.com> (raw)
In-Reply-To: <200309221355.51014.markus.klotzbuecher@creamnet.de>
Hi,
Thanks for your information.
The method you suggested works fine but I still have a
requirement. The control is still in the process and
could not see the command prompt. The thing is that I
should get the command prompt whenever the process is
put into background so that I can issue some other
command on the prompt.
Any clues??
with regards,
M. SilambuChelvan
--- Markus Klotzbuecher
<markus.klotzbuecher@creamnet.de> wrote:
> On Monday 22 September 2003 12:48 pm, Silambu
> Chelvan wrote:
> > Hi all,
> >
> > I have written some program with signal handler.
> Is
> > this possible, if
> > one of the signals registered with my program is
> > raised, my program
> > should goto background and should come to
> foreground
> > when some other of the
> > registered signal is raised. how to do it?
> >
> > Any function available to switch a process between
> > foreground and
> > background at runtime?
>
> Hi
>
> Switching a task between forground and background is
> nothing else as
> suspending and restarting. What i would try to do
> is, when you get the signal
> you want to suspend on, call the pause() function
> (see pause(2) ). When you
> get the signal you want to restart on, just do
> nothing as this will let the
> pause() function return and continue doing what
> happend before suspend.
>
> Try something like this:
>
> ***************************************
> #include <signal.h>
> #include <stdio.h>
>
> void suspend()
> {
> printf("Suspending...\n");
> pause();
> }
>
> void wake()
> {
> printf("Woken up.\n");
> }
>
> int main()
> {
>
> signal(SIGUSR1, suspend);
> signal(SIGUSR2, wake);
>
> while(1) {
> /* do whatever */
> printf("doing whatever...\n");
> sleep(1);
> }
> }
>
> Cheers
>
> Markus
> -
> To unsubscribe from this list: send the line
> "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at
> http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at
http://www.linux-learn.org/faqs
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next prev parent reply other threads:[~2003-09-22 12:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-22 11:55 Switching between foreground and background Markus Klotzbuecher
2003-09-22 12:38 ` Silambu Chelvan [this message]
2003-09-22 14:37 ` Markus Klotzbuecher
-- strict thread matches above, loose matches on Subject: below --
2003-09-22 10:48 Silambu Chelvan
2003-09-22 15:37 ` John T. Williams
2003-09-22 15:51 ` Silambu Chelvan
2003-09-23 11:01 ` Raghuveer
2003-09-23 16:07 ` John T. Williams
2003-09-23 17:24 ` Mariano Moreyra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030922123822.71099.qmail@web20003.mail.yahoo.com \
--to=silambu_mdu@yahoo.com \
--cc=linux-newbie@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox