Wish Interoperability between B4a and the Threading-Library

D

Deleted member 103

Guest
Hi,

can you improve the interoperability between B4a and the Threading-Library?
Why should B4a only use a processor if today's smartphone has multiple processors?
For me that would be a very great advantage and help.

I'm just asking because of my problem here.
I've done a lot of testing, but with the Threading Library I get the best results, without deteriorating the update rate.
The ad is smoother and does not stutter.

I do not know how difficult it is for you,
but I think you have already mastered a lot of difficult task. ;)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Why should B4a only use a processor if today's smartphone has multiple processors?
B4A doesn't use a single processor. Many libraries do many things with background threads. B4A internal framework maintains an efficient pool of threads to help libraries developers build implementations that use multiple threads.

In 99.99% of the cases you shouldn't use the Threading library. There are better and simpler solutions. However if you reached the conclusion that your case does require it then you can use it. You need to understand that you cannot access UI from a background thread and that you should be careful with synchronization issues.
 
D

Deleted member 103

Guest
In 99.99% of the cases you shouldn't use the Threading library. There are better and simpler solutions.
Unfortunately I can not find a better solution than the solution with the Threading Library. :(
Then my case belongs to the 0.01% :rolleyes:

The task is: a beep should be issued every full second, from 10sec. to 0.
With the timer, I update the labels every 25ms and with the threading library every 5ms.
With the timer I have an output error of up to 40ms, with the threading library an output error with a maximum of 4ms.
Here again the logs.
Test with Timer:
Run-IntervalMSecOrg= 9992
Run-IntervalMSecOrg= 8979
Run-IntervalMSecOrg= 7993
Run-IntervalMSecOrg= 6983
Run-IntervalMSecOrg= 5983
Run-IntervalMSecOrg= 4992
Run-IntervalMSecOrg= 3990
Run-IntervalMSecOrg= 2992
Run-IntervalMSecOrg= 1983
Run-IntervalMSecOrg= 985
Total= 10016ms
Run-IntervalMSecOrg= 9973
Run-IntervalMSecOrg= 8994
Run-IntervalMSecOrg= 7995
Run-IntervalMSecOrg= 6999
Run-IntervalMSecOrg= 5999
Run-IntervalMSecOrg= 4995
Run-IntervalMSecOrg= 3993
Run-IntervalMSecOrg= 2960
Run-IntervalMSecOrg= 1993
Run-IntervalMSecOrg= 981
Total= 20002ms
Run-IntervalMSecOrg= 9983
Run-IntervalMSecOrg= 8994
Run-IntervalMSecOrg= 7999
Run-IntervalMSecOrg= 6979
Run-IntervalMSecOrg= 5968
Run-IntervalMSecOrg= 4996
Run-IntervalMSecOrg= 3998
Run-IntervalMSecOrg= 2990
Run-IntervalMSecOrg= 1998
Run-IntervalMSecOrg= 991
Total= 30007ms

Test with Threading:
Run-IntervalMSecOrg= 9996
Run-IntervalMSecOrg= 8998
Run-IntervalMSecOrg= 7998
Run-IntervalMSecOrg= 7000
Run-IntervalMSecOrg= 5996
Run-IntervalMSecOrg= 5000
Run-IntervalMSecOrg= 3997
Run-IntervalMSecOrg= 2996
Run-IntervalMSecOrg= 1995
Run-IntervalMSecOrg= 997
Total= 10004ms
Run-IntervalMSecOrg= 9998
Run-IntervalMSecOrg= 8999
Run-IntervalMSecOrg= 7996
Run-IntervalMSecOrg= 6999
Run-IntervalMSecOrg= 5997
Run-IntervalMSecOrg= 4997
Run-IntervalMSecOrg= 4000
Run-IntervalMSecOrg= 2996
Run-IntervalMSecOrg= 2000
Run-IntervalMSecOrg= 997
Total= 20004ms
Run-IntervalMSecOrg= 9997
Run-IntervalMSecOrg= 8996
Run-IntervalMSecOrg= 7998
Run-IntervalMSecOrg= 6996
Run-IntervalMSecOrg= 5998
Run-IntervalMSecOrg= 5000
Run-IntervalMSecOrg= 3997
Run-IntervalMSecOrg= 2996
Run-IntervalMSecOrg= 1997
Run-IntervalMSecOrg= 1000
Total= 30000ms
 
Top