On 02-01-18 04:17, binghoo dang wrote:
The code actually works, but for me, I found it very strange, the threadIdelPRocss is something not D. and data will be passed using void * data, which is not D as well.
I tried to use the D lang signal/solt in STD-library, but, it's not suitable for gtk main thread as well. which i want to do is emit or send some msg in a clean GUI-less D thread, when data got, it tells the main gtk gui to display that data. using socket api to do such thing is a way, but it's another kind of complex.
So, is there a more idiomatic and simple way of doing this?
You could use glib.Idle in combination with std.concurrency:
https://gist.github.com/MikeWey/f16073ed3ce905067fcb62cc6bb1b9c0#file-demomultithread-d-L132
std.signals is not thread safe and std.concurrency would be the D way to
pass messages between threads.
PS: why GtkD is not a kind thing like PyGI using the introspection kind of binding instead of using static binding ? AND I found the gernerated GtkD is not that valueable for a reference, all description is just copied from gtk-c document, it's useless. So when I learning to use something, what I did is just reading PyGtk3 tutorial and then find out is there a equal in GtkD, it's painfull. But, anyway, GtkD is useable. Thanks for the greate project.
GtkD is generated using gobject introspection, doing this at runtime
like PyGi doesn't seen feasible to me for a strongly typed, compiled
language.
And indeed the documentation can use some work.