Re: Thread-save posting of events



Tobias Rapp wrote:
Hello!

I'm new to this list and also a novice in GTK programming. My company is
considering to port some of our Windows service (aka daemon)
applications to GNU/Linux and thus I'm evaluating what libraries to use
for that. Currently I'm programming with Delphi5 on Windows and I plan
to use gcc C/C++ on GNU/Linux.

Most of our applications are some kind of TCP/IP servers which have each
client implemented as one thread. The communication between the threads
is performed by sending standard windows messages (PostMessage() or
SendMessage() if somebody here is familiar with the Win32 API).

I had a look at GTK/GLib and the main/event loop seems to be similar to
that. But what is not clear to me is how to place an event in the event
loop of another thread. If I raise an signal the connected slots will be
executed immediately, or? Thus this mechanism seems not to be useful for
inter-thread-communication. Maybe I have to use a pipe and assign
read/write handlers in each thread?

I've only come across it while looking for other things, but perhaps the GAsyncQueues stuff would be useful for thread-to-thread comms?

http://developer.gnome.org/doc/API/2.0/glib/glib-Asynchronous-Queues.html

You probably still need watch routines executing the the various event loops (guessing).

rick jones
still only learning this stuff himself.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]