Re: [gtkmm] 2 mainloops in 2 different threads?
- From: Paul Davis <pbd op net>
- To: Stephan Puchegger <puchs ap univie ac at>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [gtkmm] 2 mainloops in 2 different threads?
- Date: Thu, 19 Sep 2002 09:03:29 -0400
>Thanks for the reply!
>
>Also thanks for the pointer to "Model-View-Controller". I will have a look
>at it and perhaps I will then understand why I should/need not have two
>main loops. Please forgive my ignorance which is due to me not being a
>computer scientist but a material physicist.
>
>I am pretty sure, that I do not actually need two main loops, but I face
>the problem, that the library can be incorporated into a a GUI programm or
>or simple "script like programm", that has no main loop in the first
>thread. I nevertheless need to service the database link. So either the
>programm has two main loops (one doing whatever the user wants it to do
>(Gui, ...) and the second connected to the database) or just one mainloop
>(connected to the database). The library should be the same for both
>szenarios. And thats why I came to this solution. I believe (I do stress the
>word believe - I do not know for sure), that possibly having two mainloops
>is not the worst solution to this problem. I am always willing to have a look
>at other possible solutions - e.g. "Model-View-Controller" and I am very
>grateful, that you have pointed out this concept.
ok, now i understand why you have two main loops. whether you really
need them or not depends mostly on whether there are any real-time
aspects to the database operation. by real-time, i mean "time
constrained".
if not (and i suspect that this is the case), then you should be able
to just hook the database code into the GUI main loop by providing an
API for the library that:
1) exposes 1 or more file descriptors that can be polled for
"read possible" or "write possible"
2) callbacks to be executed when either of these conditions
occurs.
--p
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]