[Xcb] [RFC] XCB without use of malloc()
maximlevitsky at gmail.com
Sun Jan 6 19:02:33 PST 2008
On Sunday, 6 January 2008 19:52:17 Barton C Massey wrote:
> In message <200801061423.02484.maximlevitsky at gmail.com> you wrote:
> > Yes, I have thought about this, a single thread that gets
> > all events, and wakes other ones,.. but what is wrong with
> > making each thread have a separate connection, what are
> > the disadvantages?
> You may run servers on some wacky machines out of
> connections after just a few. You'll also burn some
> client-side resources. This is probably not a showstopper
> for three connections, but utterly no good for 100.
Exactly, I just discovered that QT is single threaded for example,
only one thread can be the GUI thread.
I think that multi-threading can be good in case an app shows multiply
instances of itself,
eg webbroweser with several open windows. The number of windows won't be high,
they could be separate processes thus using separate connections for sure.
> You have to synchronize the activities of the various
> connections. The X server is trying to help you by
> processing requests on a connection sequentially, so that
> you know when things are done etc. It will process requests
> from multiple connections in an arbitrary order, though. If
> you are synchronizing threads on the client side, then you
> probably also need to be synchronizing activities on the
> server side.
This is exactly what I don't need, if the threads work on different windows.
this is the point, I want to have
about 3~5 threads each serving its own top-level windows and its children
Even more, if someday the X will implement parallel processing of requests
from different clients, the app will instantly benefit from this.
So to summarize my question is:
If I have several threads, and each serving its own subset of windows, and the
subset is a top level window with its children, is it ok for each thread to
open a separate connection to X (the threads are more like separate
applications in that case) ?
In other cases, when the main thread does most of work, and others just help
(for example draw some widget, put video inside a player, and so on, for sure
there is no need to open separate connections)
Best regards, and big thanks for help,
More information about the Xcb