ualarm() Interrupting select()

W

William

For the following code snippet:

for ( ;; ) {
numFDInSet = select( fdmax+1, &readfds, NULL, NULL, &tv );

// ...

signal( SIGALRM, alarm_handler );

// ...

ualarm( waitPeriod * 1000, 0 );
}

The problem being if the alarm goes off when select() is scanning the
FD_SET, select is interruped with the following error:

Error on select(): Interrupted system call

Ideally, when the alarm goes off, I would still want select() to continue
scanning the FD_SET and the "main loop" to continue ( select() is inside
the main loop ). Any suggestions to achieving achieving this is
appreicated.
 
J

Jack Klein

For the following code snippet:

for ( ;; ) {
numFDInSet = select( fdmax+1, &readfds, NULL, NULL, &tv );

// ...

signal( SIGALRM, alarm_handler );

// ...

ualarm( waitPeriod * 1000, 0 );
}

The problem being if the alarm goes off when select() is scanning the
FD_SET, select is interruped with the following error:

Error on select(): Interrupted system call

Ideally, when the alarm goes off, I would still want select() to continue
scanning the FD_SET and the "main loop" to continue ( select() is inside
the main loop ). Any suggestions to achieving achieving this is
appreicated.

There are no functions named select or ualarm defined by the C++
language. These are extensions provided by your particular
compiler/operating system combination, not the language. You need to
ask in a group that supports that combination.

There isn't enough information in your post's headers for me to tell
for sure, so I'll suggest a few possibilities:

for Linux
for UNIX variants
for Windows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top