-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Async Signals #1043
base: master
Are you sure you want to change the base?
[WIP] Async Signals #1043
Conversation
c5893d7
to
e9838b5
Compare
API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-1043 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, this is very cool!
From the title I was first worried this might cause many conflicts with #1000, but it seems like it's mostly orthogonal, which is nice 🙂
I have only seen the first 1-2 files, will review more at a later point. Is there maybe an example, or should we just check tests?
if os.get_thread_caller_id() != os.get_main_thread_id() { | ||
panic!("godot_task can only be used on the main thread!"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We typically use Rust's thread APIs for this, see e.g. here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do that, but it needs #1045
2877010
to
9687f3b
Compare
I am currently testing it with my project.
|
i'd guess it's related to using |
Shouldn't the hot-reload hack only leak memory? 🤔 @jrb0001 does the segfault occur on every hot-reload? |
I am not completely sure yet. It doesn't happen if there are no open scenes or if none of them contains a node which spawns a Future. It also doesn't seem to happen every single time if I close all scenes and then open one with a Future before triggering the hot-reload. In this case it panics with some scenes:
With another scene it segfaults in this scenario. Simply reopening the editor (same scene gets opened automatically) and then triggering a hot-reload segfaults for both scenes. With both executor + Future from this PR, the hot-reload issue doesn't happen at all?!? So the issue could also be in my code, let me debug it properly before you waste more time on it. I will do some more debugging later this week (probably weekend). I also finished testing the Future part of the PR and it works fine with both my old executor and your executor in my relatively simple usage. Unfortunately all my complex usages (recursion, dropping, etc.) need a The |
9687f3b
to
23179c6
Compare
Yeah, it's completely unnecessary now. Probably an old artifact. I removed the bound.
Can you elaborate what the issue here is? I'm also curious what your use-case for the |
@jrb0001 Do you have an idea what could have triggered this? The only thing that I can think of is that a waker got cloned and reused after the future resolved. The panic probably doesn't make any sense, since the waker can technically be called an infinite number of times. 🤔 |
This has been developed last year in #261 and consists of two somewhat independent parts:
Signal
: an implementation of theFuture
trait for Godots signals.The
SignalFuture
does not depend on the async runtime and vice versa, but there is no point in having a future without a way to execute it.For limitations see: #261 (comment)
TODOs
GuaranteedSignalFuture
. Should it be the default?CC @jrb0001 because they provided very valuable feedback while refining the POC.
Closes #261