XDrawPoint(s) etc MT safe?
Carsten Haitzler (The Rasterman)
raster at rasterman.com
Wed Oct 17 09:37:10 UTC 2018
On Tue, 16 Oct 2018 22:04:15 -0400 Dennis Clarke <dclarke at blastwave.org> said:
> On 10/16/2018 09:58 PM, Dennis Clarke wrote:
> >
> > Dear Xorg :
> >
> > Something I had not thought of came up today. Could multiple threads
> > call XDrawPoint() and then XFlush() ? Suppose sixteen threads are
> > dispatched to do some foo and each of them utters some XDrawPoint()
> > calls and then XFlush()? Is that remotely thread safe?
> >
>
> Sorry, assume XInitThreads() is in place. Am I stuck with using
> XLockDisplay() and XUnlockDisplay() and really multiple threads can
> not really do work simultaneously. That is the question.
xinitthreads should make anything in xlib "mt safe".. but only in as much as
doing the calls will not mess up xlib state or the socket/protocol pipeline.
(note that if this does happen it'd be an xlib/xcb bug).
but ... how can you sensibly have 2 threads draw to the same target in any
way ... unless you very specifically avoid ever overdrawing on the same areas
(e.g. use 4 threads and split region into a 2x2 grid of target areas to draw
into), or you always draw the same color points so that it doesn't matter which
gets drawn first etc. ... ? xflush will flush whatever is queued in the xlib
buffer irrespective of which thread put it there... :)
--
------------- Codito, ergo sum - "I code, therefore I am" --------------
Carsten Haitzler - raster at rasterman.com
More information about the xorg
mailing list