<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=koi8-r">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal>Hi,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I’ve a program developed using xlib and cairo. Just
for the reference I do mix calls between cairo and xlib, although I’m not
sure If that might be the cause of the error.<o:p></o:p></p>
<p class=MsoNormal>I get a deadlock orš a block in some situations.<o:p></o:p></p>
<p class=MsoNormal>I’ve three threads that work with xlib. One is the
main UI thread which makes calls to both xlib and cairo, another uses it just
to send a XClientMessage and third makes some xlib calls like XCopyArea and at
the end send an XClientMessage (those are for some animations).<o:p></o:p></p>
<p class=MsoNormal>I’ve called InitThreads in the beginning of the
program. I’ve also guarded all xlib calls with XLockDisplay (cairo calls
are also guarded with XLockDisplay). <o:p></o:p></p>
<p class=MsoNormal>I’m using ubuntu 10.10. <o:p></o:p></p>
<p class=MsoNormal>The stack traces are:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>(gdb)
thread 1<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#0
0xb77e5430 in __kernel_vsyscall ()<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#1
0xb71d8ba6 in poll () from /lib/tls/i686/cmov/libc.so.6<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#2
0xb70dcd80 in ?? () from /usr/lib/libxcb.so.1<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#3
0xb70dd2eb in ?? () from /usr/lib/libxcb.so.1<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#4
0xb70dd687 in xcb_writev () from /usr/lib/libxcb.so.1<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#5
0xb76ed2e9 in _XSend () from /usr/lib/libX11.so.6<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#6
0xb76ed900 in _XEventsQueued () from /usr/lib/libX11.so.6<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#7
0xb76d6588 in XPending () from /usr/lib/libX11.so.6<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>(gdb)
thread 6<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#0
0xb77e5430 in __kernel_vsyscall ()<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#1
0xb75ac829 in __lll_lock_wait () from /lib/tls/i686/cmov/libpthread.so.0<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#2
0xb75a7f3b in _L_lock_752 () from /lib/tls/i686/cmov/libpthread.so.0<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#3
0xb75a7d51 in pthread_mutex_lock () from
/lib/tls/i686/cmov/libpthread.so.0<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#4
0xb76d311a in ?? () from /usr/lib/libX11.so.6<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#5
0xb76d268a in XLockDisplay () from /usr/lib/libX11.so.6<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>(gdb) thread 7<o:p></o:p></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#0
0xb77e5430 in __kernel_vsyscall ()<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#1
0xb75ac829 in __lll_lock_wait () from /lib/tls/i686/cmov/libpthread.so.0<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#2
0xb75a7f3b in _L_lock_752 () from /lib/tls/i686/cmov/libpthread.so.0<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#3
0xb75a7d51 in pthread_mutex_lock () from
/lib/tls/i686/cmov/libpthread.so.0<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#4
0xb76d311a in ?? () from /usr/lib/libX11.so.6<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#5
0xb76d268a in XLockDisplay () from /usr/lib/libX11.so.6<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Where thread 1 is the main ui thread, currently calling
XPending (it has already called XLockDisplay) in an event loop, thead 7 is the
thread that just sends XClientMessage and thread 6 is the thread that has made
some calls to XCopyArea and is now about to make a call to XSendMessage (it is
waiting along with thread 7 for thread 1 to finish). But thread 1 never seem to
return from poll.<o:p></o:p></p>
<p class=MsoNormal>I’m not sure it is relevant (I’m by no means an
expert on linux or libc), but I’ve another thread waiting in poll
(it’s a thread for TCP/IP network communication)<o:p></o:p></p>
<p class=MsoNormal>(gdb) thread 2<o:p></o:p></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#0
0xb77e5430 in __kernel_vsyscall ()<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>#1
0xb71d8ba6 in poll () from /lib/tls/i686/cmov/libc.so.6<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>Has
anyone experience similar deadlock/block? Can this be a bug in xcb and is it
worth trying to compile xlib without xcb?<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>Thanks<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>