Re: Possible clipboard hang fix in the works

2004-03-24 Thread Harold L Hunt II
Christopher Faylor wrote:

On Wed, Mar 24, 2004 at 01:02:28AM -0500, Harold L Hunt II wrote:

Upon a cursory inspection it should be almost trivial to replace the 
call to XPeekIfEvent with a simple loop that does the same thing but has 
a timeout value that prevents it from blocking indefinitely.


Why can't you use select()?  select() takes a timeout value.
Because I won't actually be reading the pending events and processing 
them... so once I get woken up once I'll have one of two problems:

1) I'll continue to get woken for the same event.

2) I won't get woken for the same event (assuming it is the 
SelectionNotify event) when I call my function that processes all 
pending X events by calling select() in a loop.

I should explain that in #1 we don't know (and can't expect) that the 
first event will be the SelectionNotify event.  It will more often be 
the case that there are some events between when we first start waiting 
and when the SelectionNotify arrives.

Harold


Possible clipboard hang fix in the works

2004-03-23 Thread Harold L Hunt II
I was just talking to 'jst' in irc.freenode.net about the periodic 
hanging caused by the clipboard integration manager.

I took a peek at the source code again (it is tough to understand and 
tough to not cause infinite loops, that's why I look at it about once 
every 3 months) and realized that I left in something that never realy 
intended to leave in: a blocking call that waits for an X application to 
send clipboard data.

The part I am referring to is that we call XPeekIfEvent to wait for a 
SelectionNotify event to be sent back to our clipboard manager.  If an X 
application is misbehaved or if something goes wrong, then that message 
will never come.  The problem with XPeekIfEvent is that it does not 
allow for a timeout value to be specified, so it blocks forever if the 
event never comes.

Upon a cursory inspection it should be almost trivial to replace the 
call to XPeekIfEvent with a simple loop that does the same thing but has 
a timeout value that prevents it from blocking indefinitely.

Course... that means we probably can't use select... so I'll have to 
look at how XPeekIfEvent works and write something similar to it.

In any case, I might have a fix for this problem later this week or as 
early as Wednesday.

Harold


Re: Possible clipboard hang fix in the works

2004-03-23 Thread Christopher Faylor
On Wed, Mar 24, 2004 at 01:02:28AM -0500, Harold L Hunt II wrote:
Upon a cursory inspection it should be almost trivial to replace the 
call to XPeekIfEvent with a simple loop that does the same thing but has 
a timeout value that prevents it from blocking indefinitely.

Why can't you use select()?  select() takes a timeout value.

cgf