MUTEX - What Is It In Trainz??

boleyd

Well-known member
It is in C++
Mutex class
A mutex is a lockable object that is designed to signal when critical sections of code need exclusive access, preventing other threads with the same protection from executing concurrently and access the same memory locations.

I vaguely understand C++ from many years ago but do not recall this object. Its use in Trainz is unclear. The name appears in various descriptions which seem like slang for locking.
 
Outside of Trainz, this may help you understand the concept;

https://stackoverflow.com/questions/33895071/how-to-implement-class-lock-objects-for-multithreaded-access

Used in multithreading control ..

In computer programming, a mutex (mutual exclusion object) is a program object that is created so that multiple program threads can take turns sharing the same resource, such as access to a file

So in concept, in Trainz, would most likely need to be called from a script, you could call a horn sound object and lock the object so no other horn trigger could access it until your call was complete.. I'm guessing but it's gotta be close
 
I agree on your example. Locking has been done for years even before C++. You used to have to do it yourself at almost the machine code level. I still do not know what MUTEX means which is not that important. A guess is MUTE item X. Where Mute is a temporary condition.
 
As Christopher explained, MUTEX is a contraction of MUTual EXclusion. If two objects can access the same database then there is a risk that while one is reading data, the other is changing the data. To prevent this a boolean lock is set to prevent access to the database when it is in use. Once process A finishes updating the database, the lock is released and process B is allowed access.

The term Mutually Exclusive means that only one of the processes can be granted access at a time.

Trevor
 
I fully understand the process. I guessed wrong on the the contraction. NASCAR could use this since they constantly try to occupy the same space with multiple vehicles.
 
So to the original question - MUTEX - What Is It In Trainz??

The "mutexes" Container is a top-level config.txt file entry used by KIND SceneryWithTrack used to refer to specific mutexes from within the "junction-vertices".

http://online.ts2009.com/mediaWiki/index.php/%22mutexes%22_Container

Type: Integer
Desc: The "junction-mutex-sharing-left", "junction-mutex-sharing-forward", and "junction-mutex-sharing-right" tags describe sharing masks for the junction's mutex. Two or more permits may be granted for a junction simultaneously if a bitwise and of their sharing masks gives a non-zero result. When a permit is requested by script for this junction's mutex, the appropriate sharing masks is selected based on the requested direction. If no direction is specified (eg. a legacy script is in use) then a sharing mask of zero is used.

http://online.ts2009.com/mediaWiki/index.php/%22junction-vertices%22_Container

Here is where the online documentation is incomplete;
A mutex (in this context) is a participant in the Trainz Permit system.

When you click on Permit, there is no information available. So now the big question is, what is the Trainz Permit System? Sound like the locking mechanism or table controlled by the mutex of that asset?
 
Information on permits can be found in "Resources/scripts/permit.gs" and "Resources/scripts/junctionbase.gs" among other places.

Copy these files to a separate reference folder before reading them. Altering any files in the resources folder will prevent your game from being able to be patched.

Trevor
 
Information on permits can be found in "Resources/scripts/permit.gs" and "Resources/scripts/junctionbase.gs" among other places.

Copy these files to a separate reference folder before reading them. Altering any files in the resources folder will prevent your game from being able to be patched.

Trevor

Thank you for that info, I have updated the Trainz Wiki page for Permit so it now contains some info;

http://online.ts2009.com/mediaWiki/index.php/Permit
 
Back
Top