Updateable isSequentiallyUpdated issue?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Danthekilla
Posts: 136
Joined: Sun Jan 17, 2010 11:35 am

Updateable isSequentiallyUpdated issue?

Post by Danthekilla »

Hey Norbo I was just wondering if you could explain exactly what the code below means in the Updateable class.

/// <summary>
/// Gets and sets whether or not the updateable should be updated sequentially even in a multithreaded space.
/// If this is true, the updateable can make use of the space's ThreadManager for internal multithreading.
/// </summary>
private bool isSequentiallyUpdated = true;

I cannot quite work out if it enables multithreading when set to true or false.

The description above makes me think that setting it to TRUE will enable multithreading, but the variables name makes me think otherwise as Sequentially updating a list of things wouldn't be able to have multithreading.

Could you give me a heads up on what it does?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Updateable isSequentiallyUpdated issue?

Post by Norbo »

An UpdateableManager has two separate lists of updateables: those which can all be updated in parallel with each other, and those which must be executed in sequence. The updateables that are executed in sequence are able to make use of the ThreadManager because the ThreadManager isn't currently being used to update multiple updateables.

For example, the CharacterController should update in parallel with other CharacterControllers, because the CharacterController does not need to use a ThreadManager within its update process. So, its IsUpdatedSequentially is set to false.

If, on the other hand, you had a single updateable which looped over hundreds of objects with its own internal multithreading logic, you would not want other updateables running at the same time hogging the resources. So, its IsUpdatedSequentially should be set to true.

IsUpdatedSequentially = true is the default to avoid any sneaky problems that could arise when developing a new updateable without being careful about running in the multithreaded context caused by setting IsUpdatedSequentially = false.
Danthekilla
Posts: 136
Joined: Sun Jan 17, 2010 11:35 am

Re: Updateable isSequentiallyUpdated issue?

Post by Danthekilla »

Cool thanks I was just confused with the wording :)

Thanks!
Post Reply