Something to help future users

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

DaMacc
Just popping in
Just popping in
Posts: 1
Joined: Mon Aug 02, 2010 19:19

Something to help future users

Postby DaMacc » Mon Aug 02, 2010 19:55

This is something that I head a lot of issues with: Cegui kept crashing when resizing a falagard window (the demo8 layout to be specific). It contains text that automatically wraps depending on width of the falagard window.

Why did it do that?

I was injecting the mouse position from wndProc, and my renderer was in a different thread! So basically it was resizing the text and deleting stuff while it was being rendered.

I hope if someone has the same issue he will find this post on google and it will save him some hours of debugging :)

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Something to help future users

Postby CrazyEddie » Tue Aug 03, 2010 18:39

Thanks for posting.

Just to confirm the implications of your post - CEGUI is not currently thread safe :?

CE.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Something to help future users

Postby Jamarr » Wed Aug 04, 2010 17:06

How do you define "thread safe"? In terms of the SGI STL, they define "thread safe" only as concurrent read access. In other words, if multiple simultaneous threads can safely read from an object, then it is considered to be thread-safe.

In the case above, the user is writing in one thread and reading in another. In this case it is the clients responsibility to ensure mutual exclusion between threads, because it is simply too inefficient to make every object operation atomic. And in some cases the client code would have to specify when to lock anyway; for instance, if thread1 needs to read from and write to the object, and thread2 tries to write to the object after the read but before the write in thread1, the user would still need to manually specify the locking operations.

So my question is, does CEGUI modify windows during System::renderGUI? If it does not, then I think we can consider CEGUI to be thread safe, at least in the sense that it is the clients responsibility to ensure mutual exclusion when performing write-operations. If it does, then we may want to look into why CEGUI needs to modify a window in the drawing phase and perhaps see if that can be refactored.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Something to help future users

Postby CrazyEddie » Thu Aug 05, 2010 08:49

CEGUI can modify things during the render call.

Some of that is mutable data that is flagged as stale and only updated the next time it's read (which may, or may not be during rendering), this does not really count, since the writes are only to get valid data that can re returned from some accessor (though I guess you could get two threads trying to update that data at the same time). I'm unsure why some of the drawing calls are non-const in the more general sense though. It's probably something to look at, I agree.

CE.


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 7 guests