W dniu 13.01.2011 21:12, Henry Vermaak pisze:
On 13 January 2011 19:51,<dib...@wp.pl> wrote:
I'm trying with "dbus_connection_set_watch_functions" but this is not easy
like it look. I thought that I must only register my event procedures by
calling this functions but there is much more work. I have a headache. Now I
understand why dbus documentation begins with the words "If you use this
low-level API directly, you're signing up for some pain" ;) . Tomorrow I
look for some "live example" of using this functions in C.
Indeed, it's pretty ugly.
I tried with thread. It doesn't catch all signals even if I call sleep(1) in
loop. I don't know what is reason of this loss. Thread and AddEventHandler
have this same problem - they don't catch all signals. Only one way which
works is "g_main_context_set_poll_func" but now I see that the application
consumes 30% CPU. So now I understand why it catch all signals. @Matthias
how you solved problem with CPU and this function?
I changed your code to run in a thread and it works well for me. I
made a thread safe TQueue derivative that I add messages to, then I
notify the gui thread with PostMessage. The gui thread pops the
messages from the queue and displays them. This works even if I add
huge delays in the gui thread, since the queue is a buffer. This
solution should also work with other widgetsets.
I'll send you some code tomorrow (it's on my work computer).
Henry
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Thanks. I'm waiting.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal