We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threading
#10
This is the bit where DoWork1, DoWork2 and DoWork3 are called async (in parallel on different threads), see 4th argument of CallAsync command.

Code:
LDCall.CallAsync("litdev.dll","litdev","ldcall","function","1=DoWork1;2=1000;")
LDCall.CallAsync("LitDev.dll","LitDev","LDCall","Function","1=DoWork2;2=2000;")
TextWindow.WriteLine(LDCall.CallAsync("","","","DoWork3",""))

In this case, DoWork1 has num1=1000, DoWork2 has num2=2000 and DoWork3 has num3=3000.

So DoWork1 is fastest, and DoWork3 slowest.

As DoWork1 finishes, the current state is that total1 = 250500250000 (just finished), and total2 and total3 have made similar progress, but not completed.
As DoWork2 finishes, the current state is that total1 = 250500250000 (unchanged), total2 = 4004001000000 (just finished), and total3 still going.
Finally, as DoWork3 finishes, all 3 totals are completed.
[-] The following 1 user Likes litdev's post:
  • jrmrhrb00
Reply


Messages In This Thread
Threading - by jrmrhrb00 - 01-09-2025, 03:27 PM
RE: Threading - by AbsoluteBeginner - 01-09-2025, 07:12 PM
RE: Threading - by litdev - 01-10-2025, 11:40 AM
RE: Threading - by jrmrhrb00 - 01-10-2025, 06:58 PM
RE: Threading - by z-s - 01-11-2025, 02:33 AM
RE: Threading - by litdev - 01-11-2025, 10:30 AM
RE: Threading - by jrmrhrb00 - 01-11-2025, 06:25 PM
RE: Threading - by litdev - 01-12-2025, 08:15 AM
RE: Threading - by jrmrhrb00 - 01-12-2025, 02:32 PM
RE: Threading - by litdev - 01-12-2025, 10:48 PM
RE: Threading - by jrmrhrb00 - 01-13-2025, 07:51 PM

Forum Jump:


Users browsing this thread: 4 Guest(s)