General Chat Thread, That'll be the mutex in General; I'm sure this means something to programmers but it had me confused. Am I just thick?...
19th January 2010, 01:44 PM #1
That'll be the mutex
I'm sure this means something to programmers but it had me confused. Am I just thick?
19th January 2010, 02:13 PM #2
doesnt help at all but it was bugging me as i had heard it before
(1) Short for mutual exclusion object. In computer programming, a mutex is a program object that allows multiple program threads to share the same resource, such as file access, but not simultaneously. When a program is started, a mutex is created with a unique name. After this stage, any thread that needs the resource must lock the mutex from other threads while it is using the resource. The mutex is set to unlock when the data is no longer needed or the routine is finished.
19th January 2010, 02:15 PM #3
[ame=http://en.wikipedia.org/wiki/Mutual_exclusion]Mutual exclusion - Wikipedia, the free encyclopedia[/ame]
19th January 2010, 04:46 PM #4
A mutex is a lock on a variable, so that you know you can trust it between interrogating it and setting it.
Example: I have a variable called var1, which is an ID number for a database row, and two threads - A and B. Thread A checks that var1 equals a sensible row number and then uses it to load the row from the database. However, between checking and using, thread B changes the value to -42, which is rubbish, and thread A gets terminated because it tries to access unallocated memory. A mutex blocks thread B from changing the variable until thread A has finished with it.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)