Sign in to follow this  

[.net] C/C++: select() and signal() ??

This topic is 4072 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

C/C++ gurus, I am looking a some code written by another person:
int main()
{
...
signal(...);
signal(...);
signal(...);
...

time_struct.tv_sec = 0;
time_struct.tv_usec = 500000;

select( (int) NULL, (fd_set *)NULL, (fd_set *)NULL,(fd_set *)NULL, &time_struct );
...
return 0;
}

Notice all the parameters passed to select() are NULL, what is the purpose of this call to select()? How is select() related to the signal() calls, if at all?

Share this post


Link to post
Share on other sites
Here select() will be waiting for 500000 microseconds. signal() registers signal handlers, which are handled asynchronously and thus may be called even while select() is waiting. Knowing what the signals are would be helpful.

These aren't C/C++ but POSIX functions.

Share this post


Link to post
Share on other sites

This topic is 4072 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this