A Common Multithreading Mistake
When a new thread is created to handle the dataClose() method, the main thread may exit earlier than the new thread, which results in undesirable behavior when the new thread exits.
NOTE: Although this software attempts to hide multithreading programming issues, your application must handle this situation.
The solution is shown in the example below. Line //1 ensures that the new thread exits before the main thread goes out of scope, by forcing the IOU to be redeemed. This blocks the main thread until the dataClose() operation has completed.
 
void main()
{
RWFtpClient client;
...
// do file transfer processing
...
// incorrect !!!
client.dataClose();
// instead, use RWFtpReply reply = client.dataClose(); //1
// or assign to IOU and use the callback mechanism
// or assign to IOU and use the polling mechanism
}