| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Mutex semaphores |
-=> Quoting Jonathan de Boyne Pollard to Phil Crown <=-
JdBP> If this causes problems with code based upon the results obtained,
JdBP> then your granularity is too fine, and should be coarsened. For
JdBP> example, assume that `someFn' above were returning whether a list was
JdBP> empty or not, that the calling code were
JdBP> if (someFn()) // List is empty
JdBP> delete the_list, the_list = 0 ; // So destroy the list
JdBP> and than it was not desired that a non-empty list be destroyed.
JdBP> In this case, the entire `if' statement should be an atomic
JdBP> operation, not just the test function, otherwise another thread could
JdBP> add elements to the list in between the time that the test function
JdBP> exits its mutex section and the time that the first thread actually
JdBP> destroys the list.
Thanks, now I need to learn what an "atomic" operation is?
Phil Crown
pcrown{at}airmail.net
http://web2.airmail.net/pcrown/
--- Blue Wave/OS2 v2.30
* Origin: * MacSavvy OS/2 BBS * Dallas, Texas * 972-250-4479 * (1:124/1208)SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1 @PATH: 124/1208 1 396/1 270/101 712/515 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.