SocketTools .NET Edition

FileTransfer.TaskWait Method ()

Wait for all asynchronous tasks to complete.

[Visual Basic]
Overloads Public Function TaskWait() As Boolean
[C#]
public bool TaskWait();

Return Value

This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

Remarks

This overloaded version of the TaskWait method will cause the current working thread to block until all background tasks created by this instance of the class have completed. If there are no active background tasks, this method will return to the caller immediately.

You should not call this version of the method from the main UI thread. Windows messages will not be processed while this method is blocked waiting for the background tasks to complete, and this can cause your application to appear non-responsive to the end-user. If you have a GUI application and you need to determine if all tasks have completed, create a timer to periodically check the value of the TaskCount property. When it returns zero, there are no active background tasks executing.

See Also