MOO-cows Mailing List Archive


Mutual Exclusion

Is there a way to gurantee that only one task can access a variable at a
given time?

I have a financial-flow simulation where hundreds of robotic "consumers"
are engaging in various transactions.  I suspect I'm getting into trouble
when I check an account to see if it has the required sum of currency
withing, and then subtract from it (in the case of a debit).  What if
another task modifies the account between those two statements?  Is there a
way I can "lock" the variable in question?


CJ Holmes                                                        Net.Dreams
Director                                            Internet Service Bureau
(707) 794-8193               

-- Our Latest and Greatest:


Home | Subject Index | Thread Index