Page 1 of 1

Updateable isSequentiallyUpdated issue?

Posted: Wed Apr 17, 2013 5:21 am
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?

Re: Updateable isSequentiallyUpdated issue?

Posted: Wed Apr 17, 2013 5:51 am
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.

Re: Updateable isSequentiallyUpdated issue?

Posted: Wed Apr 17, 2013 11:32 am
by Danthekilla
Cool thanks I was just confused with the wording :)

Thanks!