|
From: Redouane S. <red...@fr...> - 2009-07-14 18:05:36
|
I already submitted a patch for that but it was for an old version of
libdbus-c++.
The way to fix this issue is to add a file descriptor (a pipe) to the file
descriptors we poll (fds).
Then when we call leave() function we write in the pipe and it'll unblock
the poll call.
Regards.
-----Message d'origine-----
De : Pierre-Luc Bacon [mailto:pie...@sa...]
Envoyé : mardi 14 juillet 2009 17:01
À : dbu...@li...
Objet : [dbus-cplusplus-devel] leave() timeout
Calling leave() makes our application to wait for 10 sec. This can be a
problem as a user might want to restart the application during that
10sec time frame. From eventloop.cpp, I see that:
int wait_min = 10000;
158
159 DefaultTimeouts::iterator ti;
160
161 _mutex_t.lock();
162
163 for (ti = _timeouts.begin(); ti != _timeouts.end(); ++ti) {
164 if ( (*ti)->enabled() && (*ti)->interval() < wait_min)
165 wait_min = (*ti)->interval();
166 }
167
168 _mutex_t.unlock();
169
170 poll (fds, nfd, wait_min);
>From what I get of this portion of code, it loops to find the
DefaultTimeout with the smallest time interval, then poll with that
value.
Is this meant to be used internally for dbus-c++ only or could we
add_timeout(Timeout::Internal *) without fear of breaking the eventloop
mechanism ?
Since:
while (_running) {
do_iteration();
}
in enter() (eventloop-integration.cpp) and:
void BusDispatcher::leave()
{
_running = false;
}
wouldn't it be better to think of another way to leave the event loop in
a more instantaneous manner ?
Pierre-Luc Bacon,
Savoir-Faire Linux
http://www.sflphone.org
----------------------------------------------------------------------------
--
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
dbus-cplusplus-devel mailing list
dbu...@li...
https://lists.sourceforge.net/lists/listinfo/dbus-cplusplus-devel
|