You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CheshireCaat edited this page Mar 9, 2020
·
14 revisions
Running functions through threads is very similar to a regular launch through BasRemoteClient. The main feature of this type of launch is that you can control the launch yourself, stop the thread, and check whether it is busy with the execution of functions. This is very convenient cause it gives you complete control over the execution of functions.
If you want to create new thread then use client.CreateThread() method. This method returns IBasThread interface, that contains several useful methods and properties. Take a look at example.
varthread=client.CreateThread();// Set up proxy.awaitthread.RunFunction("SetProxy",newParams{{"Proxy","127.0.0.1:11185"},{"IsSocks5","true"}}).GetTask();// Check the ip of this proxy.varproxyIp=awaitthread.RunFunction("CheckIp",Params.Empty).GetTask();// Stop the thread.thread.Stop();
Obviously, starting threads manually and calling functions through client is very similar. But in the case of a manual start, you can, for example, wait for the thread to finish working using IsRunning property.
// Run function without await.thread.RunFunction("SomeFunction",Params.Empty);// Wait until function complete.while(thread.IsRunning){awaitTask.Delay(TimeSpan.FromSeconds(10));}