Why is this stopping my process? And how to avoid it?
floitsch12/12/2022 01:52 PM
Globals and statics are initialized at first access.
floitsch12/12/2022 01:53 PM
Once the initializer has been finished, the return value is assigned to the global and used from then one.
floitsch12/12/2022 01:54 PM
The error message you are getting is, because something accessed a global (client) in a task, but hasn't returned yet. In a different task you accessed the same global, which leads to the error.
floitsch12/12/2022 01:57 PM
Actually. I'm wrong; In that case we just wait for the first one to finish.
floitsch12/12/2022 01:58 PM
What you are hitting here is simpler: You are trying to read a global that is being initialized while initializing it.
floitsch12/12/2022 01:58 PM
Simplified example: use_global:
print global
return 499
global := use_global
main:
print global
floitsch12/12/2022 01:58 PM
In your case the global is client.
OPKoirin
Why is this stopping my process? And how to avoid it?
floitsch12/12/2022 02:06 PM
It's not completely clear why client is showing up in the stack-trace, though. In my test-case, the global name is the last one before run_global_initializer_.
floitsch12/12/2022 02:06 PM
Do you maybe have a bit more context?
Koirin12/13/2022 08:02 AM
I found the error. Just some variable-name errors. Thanks for the help
Koirin12/13/2022 08:07 AM
Although, I do have another question. I updated Visual Studio to the 2022 update, and now I am missing the Toit Extentions. But when I try to install it, nothing really happens. Visual Studio doesn't really react, and I can't find Toit anymore on their "marketplace". Have you seen this before?
OPKoirin
Although, I do have another question. I updated Visual Studio to the 2022 update, and now I am missing the Toit Extentions. But when I try to install it, nothing really happens. Vi...
floitsch12/13/2022 08:46 AM
Visual studio 2022 and vscode are two completely different products. I don't think their extensions are compatible.
floitsch
Visual studio 2022 and vscode are two completely different products. I don't think their extensions are compatible.
Koirin12/13/2022 08:56 AM
You are correct, and I have made a big but innocent mistake. I am back on track now What vacations doesn't do to you
1
Koirin12/13/2022 09:54 AM
Now I've fixed the client, but I get this stack trace error now
OPKoirin
Now I've fixed the client, but I get this stack trace error now
Koirin12/13/2022 10:02 AM
I fixed this, but I don't understand how. So, I start the client in the beginning of main, then everything works. But if I call a "client.start" in a function instead, it will give this stack-trace
floitsch12/13/2022 10:53 AM
The stacktrace seems to indicate that the client isn't connected yet.
floitsch12/13/2022 10:53 AM
The null-error is on session_ which is set during connect.
floitsch12/13/2022 10:54 AM
Setting the session_ is one of the first things connect does.