cURL / Mailing Lists / curl-library / Single Mail


Re: Question related to Re: How to stop TCP connections

From: Daniel Stenberg <>
Date: Wed, 5 Nov 2008 22:36:06 +0100 (CET)

On Wed, 5 Nov 2008, wrote:

> I do a project similar to the one described in "Re: How to stop TCP
> connections immediately?" (see
> Here you suggest that it is
> better to wait until the download that need to be cancelled is over rather
> than cancelling that thread.

Not entirely true. I suggest you cancel the transfer by the means that are

> My question is that - is there any problem in cancelling the thread and
> using a thread cleanup routine (pthread_cleanup_push()) to do the necessary
> clean up? Would such an approach prevent any memory leaks?

Just killing the thread will cause it to leak all memory that was used at that
moment. pthreads have no magic way to reclaim those resources.

Received on 2008-11-05