Hi,
I have a problem with my software in PB 2019 when I use Multithread. It seems that the application becomes "Unstable" when I use Multithread and it crashes randomly. Regardless of whether I run in IDE or executable
Apparently it is in any Thread I use in the Software, but an example that occurs is when I call a thread every 5 seconds to check Ping. After a while, the application stops responding.
Attached is a small application that measures only the ping on a Timer, and if you leave the application running, it will crash within 5 to 10 minutes.
What am I doing wrong, can you help me?
Below is an excerpt of the code:
//window > timer()
string ls_ip_ping
ls_ip_ping = is_ip_ping
SharedObjectRegister("n_shared", is_nm_thread)
SharedObjectGet(is_nm_thread, in_shared)
in_shared.post of_ping(in_callback, ls_ip_ping)
SharedObjectUnRegister(is_nm_thread)
//------------------ in_shared > of_ping
Boolean lb_success
String ls_ipaddress
Double ldbl_elapsed
n_ping ln_ping
ln_ping.of_Performance_Beg()
lb_success = ln_ping.of_Ping(aip_ping)
ldbl_elapsed = ln_ping.of_Performance_End()
if not lb_success then
ldbl_elapsed = -1
end if
a_callback.post of_ping(Long(Round(ldbl_elapsed, 3) * 1000))
//------------------ in_callback > of_ping
if IsValid(iw_thread) then
iw_thread.st_2.Text = String(ping) + 'ms'
end if