CodePudding user response:
Look at this don't know whether is PB8 wroteDownload: http://download.csdn.net/detail/zoomkey/7825937
CodePudding user response:
Support multithreading, but this problem, as you suggest using another exe to achieve better and more stable,Or you can in the timer event to deal with
CodePudding user response:
Put to the asynchronous call function in an invisible objectUse sharedobjectregister and sharedobjectunregister multithreading management can be realized the function
Specific routines see numerous examples of online
Not convenient place:
1. Generally speaking, to do overtime management, otherwise, extremely easy to infinite loop as we wait for the result
2. Thread management well yourself, otherwise, there will be puzzling error
Understand the thread of PB, the vast majority of multitasking can handle.
Of_getinfo_network, for example, () is defined in nvo_thread object, it is used to complete the task, work results can be stored in nvo_thread a Shared variable is_rn.
You may need to define a of_get_rn in nvo_thread () function is used to retrieve the results. In this process of taking the results, to check whether the timeout, if not a timeout, and is_rn have value, it returns is_rn; If the timeout, the returned timeout information
The application process is roughly such
Nvo_thread thread//thread variables, used to crawl out operation thread instance
String ls_threads array []//thread name, is used to record the thread name. Thread management are based on the thread name
.
//multi-threaded call
For I=1 to ll_Rc
//login thread name
Ls_thread [I]=string (I)//assume that thread name is serial number. Of course, the name of the rules set by you
//register thread: the thread name register into nvo_thread instance
Sharedobjectget (' nvo_thread, ls_thread [I]))
//retrieve the thread according to the thread name instance and asynchronous calls
Sharedobjectget (ls_thread [I], thread)
Thread. Post of_getinfo_network ()
Next
//at this point, the number of threads already in operation, and some may already have the results, need to pass through a loop to retrieve the results
For I=1 to ll_rc
//retrieve the thread according to the thread name
Sharedobjectget (ls_thread [I], thread)
The do while thread. Of_get_rn () & lt;> 'xxxooo//here is very critical, in all the process to have overtime management, otherwise, one not careful will be stuck in the infinite loop. I'm a put overtime calculation of_get_rn (), but you can also use other methods, the target is only one, don't let take the results become infinite loop
The yield ()
Loop
.
//thread according to name, cancel the thread. Because the thread is either a timeout, or have the result, no matter how, all want to cancel it out
Sharedobjectunregister (ls_thread [I])
Next
CodePudding user response:
PB multithreading example in the BBS download area to look for are