[Xcb] xpyb and threading
Jamey Sharp
jamey at minilop.net
Tue Feb 23 23:36:41 PST 2010
On Tue, Feb 23, 2010 at 6:14 PM, Eamon Walsh
<ewalsh.mailinglists at gmail.com> wrote:
> Josh Triplett wrote:
>> For that matter, can another thread
>> call xcb_disconnect on self->conn before you call xcb_wait_for_event?
>
> It looks like it is possible for this to race with xcb_disconnect() if
> another thread calls the "disconnect" method explicitly.
Naturally, this is a problem in pure C programs as well. I've always
figured it was a case of "yes, but don't do that." It's the
responsibility of the component that created the connection to ensure
that nothing is using it before destroying it.
>> here, you use self->conn, but can another thread make self go
>> away before you dereference it?
I believe I know less about Python internals than Josh does, but this
seems to me like the key issue--and an easily fixed one.
> An alternative would be to remove the disconnect method from xpyb
> or turn it into a no-op, but that would make it impossible to close the
> connection immediately (it would happen at garbage collection time).
In a garbage-collected language, that is certainly an interesting alternative.
Jamey
More information about the Xcb
mailing list