I
InuY4sha
Hi,
I've some sockets handled through a select() implemented this way:
/********************************************/
int main(){
......
fd_set pippo;
.....
while(1){
select(maxval+1, &pippo, NULL, NULL, NULL);
if(FD_ISSET(...){
do_this();
if(FD_ISSET(...){
do_that();
}
}
return 0;
}
/********************************************/
The sockets are the stdin and some ipc sockets... what I would need is
to to setup a timer somewhere in that code to handle a synchronous
action to perform while the select of course is still handling the
asynchronous readings.
I saw some functions like alarm, setitimer, getitimer but I don't know
the usage.. and also I don't know what happens when for instance the
socket receives something and the select triggers it to be read (and
some actions to be performed) while at the same time the timer
expires... who as the right to proceed... is the expiration signal put
to wait until the reading from the select (and following actions)
is(are) done ?
I hope you got what I'm tring to say...
Thanks in advance
RM
I've some sockets handled through a select() implemented this way:
/********************************************/
int main(){
......
fd_set pippo;
.....
while(1){
select(maxval+1, &pippo, NULL, NULL, NULL);
if(FD_ISSET(...){
do_this();
if(FD_ISSET(...){
do_that();
}
}
return 0;
}
/********************************************/
The sockets are the stdin and some ipc sockets... what I would need is
to to setup a timer somewhere in that code to handle a synchronous
action to perform while the select of course is still handling the
asynchronous readings.
I saw some functions like alarm, setitimer, getitimer but I don't know
the usage.. and also I don't know what happens when for instance the
socket receives something and the select triggers it to be read (and
some actions to be performed) while at the same time the timer
expires... who as the right to proceed... is the expiration signal put
to wait until the reading from the select (and following actions)
is(are) done ?
I hope you got what I'm tring to say...
Thanks in advance
RM