[comp.unix.questions] Programmable idling...

gwyn@smoke.BRL.MIL (Doug Gwyn) (11/09/89)

In article <89312.165038SML108@PSUVM.BITNET> SML108@PSUVM.BITNET writes:
>Is there a way under System V unix to make a program idle until an interrupt
>condition is generated?

The simplest thing is to block on a read() system call.  Usually there
is a natural place to do this..

les@chinet.chi.il.us (Leslie Mikesell) (11/10/89)

In article <89312.165038SML108@PSUVM.BITNET> SML108@PSUVM.BITNET writes:
>Is there a way under System V unix to make a program idle until an interrupt
>condition is generated ? 

pause(2)
sleep(3)
read(2)
wait(2)
might all be appropriate under certain conditions.

Les Mikesell
  les@chinet.chi.il.us

peter@ficc.uu.net (Peter da Silva) (11/10/89)

Names deleted to protect the guilty:

> >Is there a way under System V unix to make a program idle until an interrupt
> >condition is generated?

> The simplest thing is to block on a read() system call.  Usually there
> is a natural place to do this..

Um, what's wrong with !pause()!?
-- 
`-_-' Peter da Silva <peter@ficc.uu.net> <peter@sugar.hackercorp.com>.
 'U`  --------------  +1 713 274 5180.
"*Real* wizards don't whine about how they paid their dues"
	-- Quentin Johnson quent@atanasoff.cs.iastate.edu

SML108@PSUVM.BITNET (11/10/89)

Just a quick note to thank you all for your comments on my problem !  I now
have the multi-user server I was writing up and running, and if anyone out
there with as little experience as I do wants this skeelton code for setting
up such a server, just drop me a line....

Thanks again guys !

Scott Le Grand aka SML108@PSUVM.BITNET or sml108@psuvm.psu.edu

gwyn@smoke.BRL.MIL (Doug Gwyn) (11/11/89)

In article <6899@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes:
>Um, what's wrong with !pause()!?

Nothing, but often read() or accept() would be better since if it
does return (non-EINTR) the daemon can proceed to do useful work
without needing to be prodded by an interrupt.

andrew@alice.UUCP (Andrew Hume) (11/11/89)

In article <11575@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn) writes:
> In article <89312.165038SML108@PSUVM.BITNET> SML108@PSUVM.BITNET writes:
> >Is there a way under System V unix to make a program idle until an interrupt
> >condition is generated?
> 
> The simplest thing is to block on a read() system call.  Usually there
> is a natural place to do this..



the pause(2) system call was designed for this.
i am not positive system v still has this system call
but i would think so.

cacsc243@csun.edu (11/14/89)

In article <89312.165038SML108@PSUVM.BITNET> SML108@PSUVM.BITNET writes:
>Is there a way under System V unix to make a program idle until an interrupt
>condition is generated?

Do you mean to wait for a signal?  If so, then try the pause() call (section 2).
If you mean an actual HARDWARE interrupt, good luck... they're all hidden
in the kernal.

Scott