* question on select.
@ 2003-12-18 1:17 Lejanson C. Go
2003-12-18 3:53 ` Glynn Clements
0 siblings, 1 reply; 2+ messages in thread
From: Lejanson C. Go @ 2003-12-18 1:17 UTC (permalink / raw)
To: linux-c-programming
hello good day.
i have a question about the select()
function.
when should we set timeout parameter
into NULL? what is the difference of
putting timeout (0, 0) OR putting NULL
as parameter?
--
while(1) {
tv.sec = 0;
tv.usec = 0;
sel = select(fd+1, &rdfd, NULL, NULL, &tv);
}
--
--
while(1) {
sel = select(fd+1, &rdfd, NULL, NULL, NULL);
}
--
thanks a lot.
lejanson
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: question on select.
2003-12-18 1:17 question on select Lejanson C. Go
@ 2003-12-18 3:53 ` Glynn Clements
0 siblings, 0 replies; 2+ messages in thread
From: Glynn Clements @ 2003-12-18 3:53 UTC (permalink / raw)
To: Lejanson C. Go; +Cc: linux-c-programming
Lejanson C. Go wrote:
> i have a question about the select()
> function.
>
> when should we set timeout parameter
> into NULL? what is the difference of
> putting timeout (0, 0) OR putting NULL
> as parameter?
Passing NULL for the timeout parameter will cause select() to wait
indefinitely. It won't return until either one of the descriptors is
ready or it's interrupted by a signal. The return value will never be
zero (it will return a positive value if a descriptor is ready or -1
if it is interrupted).
Passing a pointer to a zero interval (tv_sec == tv_usec == 0) will
cause select() to return immediately, even if no descriptors are ready
(in which case, the return value will be zero and all of the
descriptor sets will be empty).
--
Glynn Clements <glynn.clements@virgin.net>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-12-18 3:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-18 1:17 question on select Lejanson C. Go
2003-12-18 3:53 ` Glynn Clements
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).