PDA

View Full Version : Trying to understand locks



mwalimu
12-29-2009, 03:58 AM
I've been trying to get a a grasp on the concepts of LOCKS. The documentation is either deceptively simple or it's vague, I can't decide. I just need a someone who gets them to double check my understanding.

a) LOCKs don't actually prevent a resource from being used. They are just flags that a cog can set.
b) The actual area that actual resource that a lock protects is arbitrary, that is it is up to the programmer to decide.

So my understanding is that a lock is something like a bathroom door that can't be latched. The agreement is that if the door is closed it's in use. That doesn't stop someone from barging in, it's just a prearranged signal.

Is that about right?

Phil Pilgrim (PhiPi)
12-29-2009, 04:24 AM
Right on all counts.

-Phil

mwalimu
12-29-2009, 04:28 AM
Thanks. The documentation makes it sound more complicated.

Cluso99
12-29-2009, 05:23 AM
Welcome to the forum http://forums.parallax.com/images/smilies/smile.gif

In most cases you won't need locks. I have never used them, nor have I seen code using them. So, if you are new to the prop, ignore them for now.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:

· Home of the MultiBladeProps: TriBlade (http://forums.parallax.com/showthread.php?p=786418),·RamBlade (http://forums.parallax.com/showthread.php?p=849265),·SixBlade (http://forums.parallax.com/showthread.php?p=780033), website (http://bluemagic.biz/cluso.htm)
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator) (http://forums.parallax.com/showthread.php?p=790917)
· Prop Tools under Development or Completed (Index) (http://forums.parallax.com/showthread.php?p=753439)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) (http://forums.parallax.com/showthread.php?p=778427) ZiCog (Z80) (http://forums.parallax.com/showthread.php?p=788511) , MoCog (6809) (http://forums.parallax.com/showthread.php?p=811043)
· Search the Propeller forums (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=<HOME/>&ie=&oe=&lr=)·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz (http://www.bluemagic.biz)·· MultiBladeProp is: www.bluemagic.biz/cluso.htm (http://www.bluemagic.biz/cluso.htm)

JonnyMac
12-29-2009, 06:31 AM
Love the "in use" analogy -- will have to make use of that in the PropBASIC documentation.