[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: VO (and other libraries) & Threads
Hallo!
> The X server is connected to its clients through a serial
> interface (sockets), and can probably considered thread safe.
> The X client, i.e., the program side libX11, is not thread
> safe on most systems. But as long as all calls to libX11 are
> serialized properly, it should be possible to use a multi-
> threaded VO library. This probably means, that one has to put
True.
> a huge mutex around X11.
> In other words: If VO is careful about its calls to libX11,
> it could run multi-threaded on systems that do not provide
> a mt libX11.
Yes. But what I wanted to clarifiy is, that, while this is possible,
the interface to X11 is rather huge, due to support for colors, fonts,
windows and nummerous drawing primitives. This means, that there is a
huge number of methods to be serialized/proteced. Java - a far as I
remember - supports serialisation as a keyword of a class (the virtual
engine will than do the protection) but in VO we had to put that code
explicitely in, resulting in code bload and less readable and simpler
code. We also would make VO dependend from a special thread library,
which offers us the primites for thread ahandling. This will make VO
less portable.
Note also that this is not the ultimate solution. As told, VO uses the
model-viewer paradigm at some places. Diverent threads now can
manipulate these models at the same time resulting in object state
inconstencies when not proteced by semaphores. This increases the number of
interfaces again (and I had mentioned other interfaces, too). The
question is: Should we protect at all, and if so, which interfaces
should be proteced and which not? Or is the huge number of unserialized
interfaces a design problem and should we fix it in general? Of couse
the last one it a rather academic question, since I will not totaly
rewrite VO. How do OSs or other languages (I mentioned Java, but what
about smalltalk using MV paradigm, too) solve this problem?
--
Gru...
Tim.