Re: [dwm] Status text clock patch

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Fri, 11 Jul 2008 16:25:59 +0200

On Thu, Jul 10, 2008 at 06:35:03PM +0300, John Mpanos wrote:
> After some digging around i figured what to do to draw text in the
> status area, so i wrote a simple clock using threads. I can't
> understand though why the clock doesn't get updated sometimes even
> though i call drawbar() directly from the thread run method...
> Any help would be appreciated, and also how could i do the same
> without using threads?

Well I know that you already agreed on the signal handler based
version, but I wanted to point out that Xlib isn't thread-safe,
so it is very likely that the thread-based version might
lead to aborting dwm in the X' default error handler
during a drawbar() call from your clock routine thread
in the case that dwm is performing a blocking Xlib call like
XSync() or XNextEvent() somewhere else in parallel.

If the Xlib detects that there is another libcall during a
blocking call it aborts the client and quits its connection.

Toolkits work around this issue through using a critical section
on a per connection basis or through opening additional
connections depending on the context. But dwm doesn't since it
hooks directly on top of Xlib.

Kind regards,

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Fri Jul 11 2008 - 16:26:00 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:54:09 UTC