B4J Question Classes and threading

Blueforcer

Well-Known Member
Licensed User
Longtime User
Since I didn't find anything in the documentation I just ask stupidly:

Does each class run in its own thread?
I ask because I am programming an RS485 bus that runs in its own class, and as fast as possible. Is it now completely self-sufficient from the rest of the program and I can perform other tasks in different classes without speed loss? or do I have to run it explicitly in a thread?
 
Last edited:

Blueforcer

Well-Known Member
Licensed User
Longtime User
So i have to use the Threading library from Andrew Graham for true multithreading or what is the best way?
My current project is a SPS like system, with a Bus, many logics and of course a UI. So i need to run many different things at the same time. Because Java is a multi-threaded programming language i thought B4J can also handle it
 
Last edited:
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
yes but i also have to evaluate the response, edit and calculate a process-image with many 16bit registers, furthermore many logics run through every 100ms to register changes and to switch the corresponding states. Each logic is generated dynamically at runtime as a class and runs on its own. Since there are about 26 different types of logics, some of which are used more often, the workload can already be very high. There are sometimes really many tasks that unnecessarily burden a single thread. Especially on a Raspberry Pi it would be desirable to be able to outsource single tasks to new threads.
 
Last edited:
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
I know AsyncStreams is multithreaded. This is not the problem.
For example in some cases my bus (with evaluate the response etc) stops shortly when i do some other things started by the UI.
Just to get it clear: Its not possible to create a custom Asynchronous Task?

Please don't get me wrong, as I come from VB.net it is still hard for me to understand how I can take control of my threads myself. The current project was originally programmed in vb.net and all PLC logics run in their own threads. Even the current Hardware is 20x faster than the old WinCE one, it would be nice to know how the basics work, whether I need it in the end or not.
 
Last edited:
Upvote 0
Top