Overview
Features
Download
Documentation
Community
Add-Ons & Services

FTP client thread safety?

A general discussion forum.

FTP client thread safety?

Postby mart » 02 Aug 2012, 14:36

Hi,

I'm using the FTP client parts in a multithreaded process, where each thread has its own FTP client session object. This is in a Red Hat RHEL 6.0 environment.

However, when receiving data, valgrind (or actually helgrind) reports possible problems where several threads access the same memory. Note: valgrind does not report that memory is actually shared, just that it is a possible risk.

So my question is - is the FTP client session thread safe?

Best Regards

/Mart
mart
 
Posts: 2
Joined: 02 Aug 2012, 14:26

Re: FTP client thread safety?

Postby alex » 03 Aug 2012, 05:49

mart wrote:is the FTP client session thread safe?

FTPClientSeesion class is not safe for sharing between threads, but if you keep it (and the underlying socket) in a single thread, you'll be safe.
alex
 
Posts: 1146
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: FTP client thread safety?

Postby mart » 03 Aug 2012, 09:38

Hi,

thanks for the response - just to confirm: if I have 2 FtpClientSession objects, each executing in its own thread (intended not to have anything to do with each other) - am I in trouble then? Do the FtpClientSession objects use some common memory, somewhere ... ?

I'm having trouble when one of the FTP targets is known to cause long delays when connecting to and/or serving data.

Thanks in advance :-)

/Mart
mart
 
Posts: 2
Joined: 02 Aug 2012, 14:26

Re: FTP client thread safety?

Postby alex » 03 Aug 2012, 14:31

mart wrote:Do the FtpClientSession objects use some common memory, somewhere ... ?

No.
alex
 
Posts: 1146
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron