incendio Well-Known Member Licensed User Longtime User Dec 13, 2021 #1 Hi guys, For desktop app, suppose I have 2 procedures, I want to run procedure A on thread 1 & procedure B on thread 2, can B4J do this?
Hi guys, For desktop app, suppose I have 2 procedures, I want to run procedure A on thread 1 & procedure B on thread 2, can B4J do this?
Erel B4X founder Staff member Licensed User Longtime User Dec 13, 2021 #2 The answer to the question in the title is yes. Many things in B4X are done using background threads. incendio said: For desktop app, suppose I have 2 procedures, I want to run procedure A on thread 1 & procedure B on thread 2, can B4J do this? Click to expand... Yes, with the Threading library. The real answer is that you need to provide more information as in most cases there are better options. Upvote 0
The answer to the question in the title is yes. Many things in B4X are done using background threads. incendio said: For desktop app, suppose I have 2 procedures, I want to run procedure A on thread 1 & procedure B on thread 2, can B4J do this? Click to expand... Yes, with the Threading library. The real answer is that you need to provide more information as in most cases there are better options.
alwaysbusy Expert Licensed User Longtime User Dec 13, 2021 #3 Also take a look at https://www.b4x.com/android/forum/threads/abbackgroundworkers-extracted-from-jserver.134061/#content, which is an extraction of the Background workers in jServer to a seperate library. Upvote 0
Also take a look at https://www.b4x.com/android/forum/threads/abbackgroundworkers-extracted-from-jserver.134061/#content, which is an extraction of the Background workers in jServer to a seperate library.
incendio Well-Known Member Licensed User Longtime User Dec 15, 2021 #4 alwaysbusy said: Also take a look at https://www.b4x.com/android/forum/threads/abbackgroundworkers-extracted-from-jserver.134061/#content, which is an extraction of the Background workers in jServer to a seperate library. Click to expand... I think, this is what I am looking for, thanks. Will study it to make sure. Last edited: Dec 15, 2021 Upvote 0
alwaysbusy said: Also take a look at https://www.b4x.com/android/forum/threads/abbackgroundworkers-extracted-from-jserver.134061/#content, which is an extraction of the Background workers in jServer to a seperate library. Click to expand... I think, this is what I am looking for, thanks. Will study it to make sure.
incendio Well-Known Member Licensed User Longtime User Dec 15, 2021 #5 Erel said: The answer to the question in the title is yes. Many things in B4X are done using background threads. Yes, with the Threading library. The real answer is that you need to provide more information as in most cases there are better options. Click to expand... I thought Threading library is for B4A only. Let say, there are a 1000 similar tasks, but time to finish each task may not be the same. For ex, to finish task 1 need 10 secs, task 2 need 7 secs, and so on. I want to divide these tasks into 6 threads. Thread 1 assign to task 1, thread 2 assign to task 2, and so on. When every threads finished the task, it will look for unfinished tasks, and if it found, it will do the task and repeat again the process until no more unfinished tasks exist. I think this process can't be done using built in B4X background threads. Or can it? Upvote 0
Erel said: The answer to the question in the title is yes. Many things in B4X are done using background threads. Yes, with the Threading library. The real answer is that you need to provide more information as in most cases there are better options. Click to expand... I thought Threading library is for B4A only. Let say, there are a 1000 similar tasks, but time to finish each task may not be the same. For ex, to finish task 1 need 10 secs, task 2 need 7 secs, and so on. I want to divide these tasks into 6 threads. Thread 1 assign to task 1, thread 2 assign to task 2, and so on. When every threads finished the task, it will look for unfinished tasks, and if it found, it will do the task and repeat again the process until no more unfinished tasks exist. I think this process can't be done using built in B4X background threads. Or can it?
agraham Expert Licensed User Longtime User Dec 15, 2021 #6 incendio said: I thought Threading library is for B4A only. Click to expand... No, it is Java based and works in B4J. incendio said: I think this process can't be done using built in B4X background threads Click to expand... Probably not. Use Threading or Background Worker. I would use Threading but then I'm biased because I wrote it. Upvote 0
incendio said: I thought Threading library is for B4A only. Click to expand... No, it is Java based and works in B4J. incendio said: I think this process can't be done using built in B4X background threads Click to expand... Probably not. Use Threading or Background Worker. I would use Threading but then I'm biased because I wrote it.
incendio Well-Known Member Licensed User Longtime User Dec 15, 2021 #7 agraham said: No, it is Java based and works in B4J. Probably not. Use Threading or Background Worker. I would use Threading but then I'm biased because I wrote it. Click to expand... Thanks for your replied. Personally, I prefer Background Worker because it is simpler, but I don't know if it's enough for my need. Yours definitely more advanced. I will study both methods to choose which one. Upvote 0
agraham said: No, it is Java based and works in B4J. Probably not. Use Threading or Background Worker. I would use Threading but then I'm biased because I wrote it. Click to expand... Thanks for your replied. Personally, I prefer Background Worker because it is simpler, but I don't know if it's enough for my need. Yours definitely more advanced. I will study both methods to choose which one.