[Bf-committers] 1) ESC doesn't abort render

Willian Padovani Germano wgermano at superig.com.br
Thu Jun 8 16:44:40 CEST 2006


Shaul Kedem wrote:
 > Is anyone working on a fix for the ESC problem in linux?
 > (tested in windows on a cvs build and it looks fine)

Hi,

Should have sent this info earlier, sorry.

In short: we probably have at least one or two ways to fix it. I'll be 
able to investigate more this weekend -- others are welcomed to comment 
and work on it, too, of course. Then it's a matter of deciding what is 
the best solution and commit it. The issue seems related to how *some* 
linux systems count elapsed process time when the process has threads.

Long version:

I played with this on Sunday / Monday and got it working by replacing 
occurrences of ITIMER_VIRTUAL by ITIMER_REAL and of SIGVTALRM by SIGALRM 
in src/renderwin.c. Hos confirmed it fixed it for him, too. It would be 
helpful if others with (and without) the ESC problem can try this and 
inform, thanks in advance. You have to change the file and recompile, 
this tentative fix wasn't committed.

But before trying that eeshlo had pointed to me that jandro solved the 
same or a similar issue under linux for yafray. He also gave me the link:

http://projects.blender.org/viewcvs/viewcvs.cgi/yafray/src/yafraycore/threadedscene.cc?rev=1.8&cvsroot=yafray&content-type=text/vnd.viewcvs-markup

(Hint: start with the comment marked WORKAROUND.) Nice code, easy to 
understand if you read a little about signal handling (man pages for 
signal and sigaction).

I still didn't have time to test this later one, should have on 
Saturday. It means overriding the system and checking / signaling 
ourselves SIGVTALRM in the rendering threads.

So there are probably at least two solutions. The first one is simpler, 
but might not be desirable, it might be less multitasking friendly or 
"elegant", because SIGALRM counts real elapsed time while SIGVTALRM 
counts process time.

Someone with actual experience with signals and threading can probably 
give some insight here.

Another issue is that the code uses signal() and nowadays it's 
recommended that we use sigaction(). A very quick / preliminary test 
substituting one for the other in renderwin.c didn't fix the problem, 
though. Manual page for signal suggests having a thread to handle the 
signals, btw.

Thanks eeshlo and jandro for the info / code, Hos and kaito for testing 
a fix and Ken and stivs for debug info in their systems (which do not 
have the ESC problem).

--
Willian


More information about the Bf-committers mailing list