-
-
Notifications
You must be signed in to change notification settings - Fork 461
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
WorkerThreadPool expose add_template_group_task and add_template_task #1368
Comments
Thanks! Now that we have
... you can do:
I think that code should work in a module as well! That said, for compatibility, we could probably generate an |
Hi, as long as I know Callables only bind Variant arguments, plus maybe it is intended, but inside modules I havent been able of binding any PackedVector as an argument to a callable. So I started using the add_template_group_task method with pointers to arrays. // Inside the header
#ifdef GDEXTENSION
// Workaround Method
Vector<Vector2i> _temp_save_region_keys;
void _thread_save_regions(uint32_t index);
#else
//Original Method
void _thread_save_regions(uint32_t index,const Vector2i* pool);
#endif // GDEXTENSION Also
// method add_template_group_task
_add_group_task(Callable(), nullptr, nullptr, ud, p_elements, p_tasks, p_high_priority, p_description);
// method add_native_group_task
_add_group_task(Callable(), p_func, p_userdata, nullptr, p_elements, p_tasks, p_high_priority, p_description);
// method add_group_task
_add_group_task(p_action, nullptr, nullptr, nullptr, p_elements, p_tasks, p_high_priority, p_description);
So, in summary, using add_template_group_task is good for passing custom structs, and using a Callable for mimiking the behaviour will most likely not work as a plus.... I have read a big chunk of godot source code by now and I have not find any internal use of a Callable binding a PackedVector, instead, for cases where the use of a Vector or PackedVector is necesary, the templated_task method is the one used |
It's not ideal, but you can store pointers as |
Interesting, I will take a look at it, thanks |
Godot version
master
godot-cpp version
master
System information
Windows 10
Issue description
Allow using add_template_group_task and add_template_task methods from WorkerThreadPool class that are available inside modules but in extensions.
Steps to reproduce
look at godot engine source code usage of the mentioned methods
Minimal reproduction project
create a templated method
The text was updated successfully, but these errors were encountered: