From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Tue, 9 Sep 1997 10:28:24 +0200 From: Jan Hubicka hubicka@horac.ta.jcu.cz Subject: [9fans] Porting XaoS (saga continues) Topicbox-Message-UUID: 63ada4ec-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19970909082824.AxurU5rmD4DKHFceQNb-ivwXvqudRrgGH8Y-HTxjDuw@z> Hi Yesterday I solved problem with compiler - cleaned up code. Everything seems to work now. 9c is nice, that it detects ugly code and automatically refuses it. :) Maybe UGLYNESS constant should be set higher in next version. I also did some cleaning in order to make XaoS smaller but not big success :( Just saved about 8KB of executable... Question 1: Since XaoS now seems to work, I decided to start work at multithreading. I ran into problems with plan9 api. I use following scheme: I have queue with points, each processor takes point from queue, calculates it and its neighbors and adds new points into queue if neccesary. I need an lock to queue to avoid conflicts. I found spinlocks in plan9 API, but I wonder if they eats CPU time or not. At least BeOS implementation of spinlocks is that CPU waits in loop until other CPU unlocks it. It is not what I need, since I want to do tests at singe CPU, where it should make problems.... And other problem is that in case queue is empty, thread has to asleep, since other process should be calculationg some pixel and then when he adds new points into queue, it calls wakeup function to wakeup waiting process, that should start processing new points. At the end, when threads know that he is latest working, and that queue is empty, he sets exit flag and wakes up all threads, they reads exit flag and exits imediately. Is there some sleep/wakeup mechanizm (in combination with locks, since I need to be sure that when process asleeps, queue is empty. So I need stuff similiar to cond in POSIX). Or is there some completly different way to implement this eleganlty using plan9 API? I saw sleep/wakeup implementation in docs. Is this function in libc, or do I need to copy sources? Question 2: What bitmap depts 81/2 currently supports? 1bpp,8bpp and some others? Many thanks to those, who replied to my last question. This list seems to be most helpfull from all lists I ever saw! Honza -- ------------------------------------------------------------------------------ Have you browsed my www pages? Look at: http://www.paru.cas.cz/~hubicka Koules-the game for Svgalib,X11 and OS/2, Xonix-the game for X11 czech documentation for linux index, original 2D computer art and funny 100 years old photos and articles are there!