Re: SVGAlib and threads

Search this archive.

From: Dr. Michael Weller (eowmob@exp-math.uni-essen.de)
Date: Wed 22 Jul 1998 - 15:42:54 IDT


On Wed, 22 Jul 1998, Elias Jarlebring wrote:

> I have not managed to get svgalib to work with pthread (core dump :(...
> no shutdown routine is ran). Is this an unknown bug or just something no
> one has done anything about?
> 
> 	/Elias Jarlebring

Well, I don't really know. As svgalib uses mmap'ed memory and direct I/O
it will be a general problem to access svgalib from different threads (if
the I/O priviledges and mmap'ed areas are not shared on automatic). This
is basically a requirement to the thread implementation (share any I/O
priviledges and mmap's). It is important too, that different threads don't
have different ideas in which state the VGA currently is.

Even when your program does all svgalib access in a single thread (which I
consider mandatory), I heard once that there is a problem with the signals
SIGUSR1 and 2 used for VC switches which are used by the threads too.

Now, of course, with a few #define's the signals svgalib actually uses can
be modified. But then some other application will fail, as the other
signals already have meanings.. (this is why SIGUSR1 & 2 are used right
now). So, there is no real general solution.

BTW, the readme already mentions the thread/svgalib problematic.

Michael.

> 
> System: 
> SVGAlib 1.2.13 
> S3 ViRGe
> pthread 0.5
> 
> Sample program:
> #include <pthread.h>
> .
> .
> .
> void threadFunc()
> {
> 	while(1);
> }
> void main()
> {
>    pthread_t t;
>    pthread_attr_t attr;
>    // set attr for thread
>    pthread_attr_init(&attr);
>    pthread_attr_setscope(&attr,PTHREAD_SCOPE_SYSTEM);
> 
>    // init vga here
> 
>    // start thread
>    pthread_create(&t,&attr,((void *)threadFund),(void *)NULL)
> 	
>    while(1);
> 
> }
> 

--

Michael Weller: eowmob@exp-math.uni-essen.de, eowmob@ms.exp-math.uni-essen.de,
or even mat42b@spi.power.uni-essen.de. If you encounter an eowmob account on
any machine in the net, it's very likely it's me.


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