[xcb] XCB polling and single-threadedness

Jamey Sharp xcb@nickle.org
07 Jul 2002 23:46:55 -0700


On Sun, 2002-07-07 at 03:49, Soeren Sandmann wrote:
> One comment: What does it mean when a function name is postfixed by
> "Locked"? Does it mean
> 
>         (a) "you should lock before calling this function", 
> 
> or does it mean 
> 
>         (b) "this function will do its own locking".
> 
> It looks to me like XCBFlushLocked() uses the (a) meaning, and your
> new XCBFillBufferLocked() uses the (b) meaning.

You're right. I didn't have any naming convention in mind, so things
came out inconsistently. I guess I've generally used the (a) meaning;
I'll fix FillBuffer eventually.

> The patch below makes XCBFillBuffer empty the file descriptor instead
> of calling read() just once.

Is there any reason to believe that this will make any difference? I
figure that if there's more data readable after the first read, then
XCB's buffer was filled on the first call. If that's true, the second
read will be an expensive no-op under any circumstances.

> It also inserts a FIXME comment for the
> case when the connection is closed; I am not sure what to do in that
> case.

I believe my intent was to return 0 in that case, which is interpreted
as a sort of error by XCBWait and related functions. Current FillBuffer
doesn't do so; I'll fix that.
-- 
Jamey Sharp <jamey@sharp.ath.cx> - http://jamey.is.dreaming.org/