Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Raster::Line segfaults ... sometimes. (Adding a static counter somehow fixes the issue (for me).)
Raster::Line segfaults ... sometimes. [message #44068] Mon, 22 December 2014 08:04 Go to previous message
rainbowsally is currently offline  rainbowsally
Messages: 29
Registered: December 2014
Promising Member
Adding a static counter somehow fixed the issue (for me). And then considering that something might be choking on the cpu usage in this thread, I tried a 'usleep()' which also works, and seems to be more consistent.

I am multithreading in linux. You might not have this problem.

In uppsrc/Draw/Raster.cpp I was getting seg faults ("illegal memory access") so I put a counter in the function noted below. And just adding a static counter fixed the problem.

Huh????

[Update: Well, it fixed it a little more than half the time.]

If you are having trouble with RasterTest try this. I can't see how it could do anything but add a delay (unless there's a bug in BLITZ), but I don't want to experiment any more with this at this time.

File: uppsrc/Draw/RasterLine.cpp
void Raster::Line::MakeRGBA() const
{
// -rs added these two lines
//  static int cnt;
//  cnt++;
// -rs replaced the above with this ONE line.. another "experiment".
    usleep(500); // half a millisecond

	ASSERT(fmtdata && raster);
	int cx = raster->GetWidth();
// ...


Tested, 5 times, no crashes. I'm done for now.

The half millisecond delay gives the OS plenty of time to pass a time slice to other threads. Dunno what's causing this or where the best place to deal with this is, but it might be that a "io pause" something like this should be in the main event loop. At least in Linux.

May look into this later.

[Updated on: Mon, 22 December 2014 08:29]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Multithreaded Animated GIF
Next Topic: Sound in linux
Goto Forum:
  


Current Time: Sun Apr 28 10:11:06 CEST 2024

Total time taken to generate the page: 0.68964 seconds