MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

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?

cjh

CJ Holmes                                                        Net.Dreams
Director                                            Internet Service Bureau
(707) 794-8193                         http://www.netdreams.com/net.dreams/

-- Our Latest and Greatest: http://www.netdreams.com/registry/





Follow-Ups:

Home | Subject Index | Thread Index