lukas wrote:
hi
I'm new to boost.threads and have a basic question. During program execution the user has to check the connection to a server. This action should take place in a simple thread.
Do you mean that the program attempts to make a socket connection using a new thread?
If the user gets bored waiting for responce, he should be able to stop the process and return back to the main application.
How will the user interrupt?
Is there a proper standard solution?
A common approach in POSIX would be to use non-blocking sockets and to use the select() function to wait for a change of state on the socket(s) or on standard input (or, in an X application, on the pipe or socket used by Xlib). This way, there is no need to spawn a new thread per connection (though it is useful to have another thread for doing name lookups, because there is no standard API for running them asynchronously). Under Windows you would probably use MsgWaitForMultipleObjects() or asynchronous socket operations. I'm afraid Boost.Thread doesn't cover these things, though asio http://asio.sourceforge.net/ and Giallo http://giallo.sourceforge.net/ attempt to. Ben.