[fpc-pascal] How to close TInetServer without except?

Ewald ewald at yellowcouch.org
Thu May 2 23:51:47 CEST 2013


On 02 May 2013, at 22:00, silvioprog wrote:

> 
> Lines 277 and 278. That is, I already do that. The problem now is how to stop the "Accept" but without errors.

Using linux (or some other unix like thingie), you could cancel the thread using pthread_cancel(), the call will then return immediately with a specific (can't remember which) error code in errno (socketerror in this case I believe).

Problem with pthread_cancel is that there are quite a lot of cancelation points, see http://stackoverflow.com/questions/433989/posix-cancellation-points , so be careful with this approach.

Another way would be to use a non-blocking socket to accept connections... 

--
Ewald

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130502/1b335df5/attachment.html>


More information about the fpc-pascal mailing list