Android Question B4A's multi thread debugging

dreamworld

Active Member
Licensed User
Longtime User
When one thread of my app encounter an error, the yellow bar always stop at a wrong place (where the UI thread pauses, I guess) and it is impossible to find out what caused the error.
The exception information in the log box is also wrong and helpless.

This is quite annoying!

Is this a bug of B4A?
 

dreamworld

Active Member
Licensed User
Longtime User
The thread is for socket communication. It initialize a socket, send data to server, receive data from server and process the data. This way can work with VB.NET.
 
Upvote 0

dreamworld

Active Member
Licensed User
Longtime User
Yes. The Threading library.
AsyncStreams needs to start new thread too and it requires TWO threads.
The mechanism of the socket communication of my app is:
send, receive, send, receive ...
It has to start a new thread in order to avoiding freeze the main thread.
But I will consider AsyncStreams, if my app can't work in release mode.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
AsyncStreams needs to start new thread too and it requires TWO threads.
It doesn't matter whether it starts a single thread or two threads. It happens only once. In most cases it is much simpler to use AsyncStreams then having to deal with the threading issues yourself.

But I will consider AsyncStreams, if my app can't work in release mode.
I guess you meant debug mode.
 
Upvote 0

dreamworld

Active Member
Licensed User
Longtime User
Why the debugger can not work properly with code that runs on other threads? As a promising SDK, it should be able to support multi thread development
 
Upvote 0

dreamworld

Active Member
Licensed User
Longtime User
If you can't make that at present, you should at least provide us a way to find where an error is. For example, using Log().
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Logs works properly from any thread.

One of the concepts behind Basic4android is that the developer should not deal with multithreading issues. There is very good support for multithreading under the hood. These features are used by the libraries to handle background tasks.

As I previously wrote I recommend you to use AsyncStreams. It is very powerful and there are many examples in the forum about it.
 
Upvote 0

dreamworld

Active Member
Licensed User
Longtime User
Such concept sounds a little bit strange.
B4A is actually converting Basic code into Java code, and I am sure that Java suports multi thread. How come B4A can't support multi thread development?
 
Upvote 0

dreamworld

Active Member
Licensed User
Longtime User
My understanding is that B4A can not debug apps that have multi threads, but a multi thread app can still work smoothly after release.
Is my understanding correct?
 
Upvote 0
Top