Re: PThreads Q

Search this archive.

From: Matan Ziv-Av (matan@svgalib.org)
Date: Thu 18 Apr 2002 - 17:37:59 IDT


On Wed, 17 Apr 2002, viscous liquid wrote:

> This Q is directed more towards the developers of
> SVGALib. Specifically, I have noticed that there have
> been a few people that have ran into the problem of
> using threads with svgalib because of a signal
> conflict. Now I understand that in building svgalib
> you can specify that you can change the the signal.
> Now that is fine, but does anybody foresee changing it
> so that svgalib will no longer conflict with pthreads?
> Note, this Q is meant to spark a discussion on whether
> svgalib should be compliant with pthreads.

On kernel 2.2 pthreads uses SIGUSR1 and SIGUSR2. svgalib uses by default
(at least since 1.4.1) SIGUNUSED and SIGPROF, which are both unused on
my system. I compiled and run a few threaded svgalib programs, with no
problem.
If you use kernel 2.2, and your system does use those two signals, you
need to recompile svgalib, and then you can't use pthread and svgalib
together.

On kernel 2.4 pthreads uses two RT signals, so it can not conflict with
svgalib. I run programs that use svgalib and pthread with no problems.


This signals issue is non related to thread-safety issues.
svgalib is not thread-safe, which means that if two threads of the same
program make svgalib calls, it can easily crash the system.
The solution I use is to have a single thread that calls svgalib
functions. All the other threads only write to (linear) video memory.


-- 
Matan Ziv-Av.                         matan@svgalib.org



------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:24 IST