🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #24311

Re: Why X libraries are not reentrant?

#24311
From: Kaleb Keithley
Date: Thu, 21 Jan 1993 17:18
30 lines
1733 bytes
In article bruniau@cenatls.cena.dgac.fr (Christophe Bruniau) writes:
>|> 
>|> > and Why X libraries are not reentrant?,
>|> 
>|> Because it's a lot of work and nobody's been willing to do it.
>|> 
>
>At this point, there is an interesting question:
> How does one address the problem of handling interrupts (for instance Unix
> Signals) involving X Window actions in a sequential language like C ?

Isn't this in the FAQ yet?

One (perhaps inelegant) solution involves opening a pipe and write() to
the pipe in the signal handler.  Write is re-entrant.

You can then select() for read on both the pipe and your Display connection 
and safely perform your "signal triggered" routine upon receipt of data on 
the pipe.

>An example of such a problem is when one wants to process data from a network
> while computing the MainLoop. Is the interleaving of busy waiting of Network
> data and X events the only solution ?

Network data?  In Xlib, select() on both the Display connection and the 
network data connection.  In Xt, use XtAppAddInput().

-- 

Kaleb Keithley                               kaleb@jpl-devvax.jpl.nasa.gov
Technical Details
Message-ID: <1993Jan21.171844.23941@jpl-devvax.jpl.nasa.gov>
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ufo!swat!kaleb
References: <1993Jan14.232031.9316@selway.umt.edu> <1993Jan19.025831.19583@thunder.mcrcim.mcgill.edu> <1993Jan20.090241.1810@cenatls.cena.dgac.fr>

Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.x
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ufo!swat!kaleb
From: kaleb@swat (Kaleb Keithley)
Subject: Re: Why X libraries are not reentrant?
Message-ID: <1993Jan21.171844.23941@jpl-devvax.jpl.nasa.gov>
Sender: usenet@jpl-devvax.jpl.nasa.gov (For NNTP so rrn will be able to post)
Nntp-Posting-Host: swat
Organization: Jet Propulsion Laboratory (NASA)
References: <1993Jan14.232031.9316@selway.umt.edu> <1993Jan19.025831.19583@thunder.mcrcim.mcgill.edu> <1993Jan20.090241.1810@cenatls.cena.dgac.fr>
Date: Thu, 21 Jan 1993 17:18:44 GMT
Lines: 31