• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Locks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Locks


  • Subject: Re: Locks
  • From: Ian Joyner <email@hidden>
  • Date: Sat, 10 Dec 2011 10:48:58 +1100

You are probably looking for something like Dahm locks (invented by Dave Dahm on the Burroughs B5000 in the 1960s). Here is a long paper on locks including this origin:

http://pages.cs.wisc.edu/~remzi/OSFEP/threads-locks.pdf

Here is an idea of the ALGOL define for acquire:

DEFINE
 ACQUIRELOCK (ID) =
     BEGIN
       IF READLOCK (PROCESSID, CONTENDERS[ID]) ^= 0 THEN
          DO
             PROCURE (LOCKS[ID])
          UNTIL READLOCK (-1, CONTENDERS[ID]) = 0;
       OWNERS  [ID] :=  PROCESSID;
     END #


On 7 Dec 2011, at 10:28, koko wrote:

> In windows we have:
>
> LONG volatile Mylock = 0;
> InterlockedIncrement(&Mylock);
> InterlockedDecrement(&Mylock);
>
>
> What should these be replaced with for OSX  as in :
>
> #ifndef MAC
> LONG volatile Mylock = 0;
> #else
> // Mac
> #endif
>
>
> void SetLock()
> {
> //	EnterCriticalSection(&m_cs);
> #ifndef MAC
> 	while(Mylock){Sleep(0);};		// Give up timeslice
> 	InterlockedIncrement(&Mylock);
> #else
> // Mac
> #endif
> }
>
>
> void FreeLock()
> {
> //	LeaveCriticalSection(&m_cs);
> #ifndef MAC
> 	InterlockedDecrement(&Mylock);
> #else
> // Mac
> #endif
> }
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Locks
      • From: Scott Ribe <email@hidden>
    • Re: Locks
      • From: Kyle Sluder <email@hidden>
References: 
 >Locks (From: koko <email@hidden>)

  • Prev by Date: Re: User Interface linked to two classes
  • Next by Date: Re: Locks
  • Previous by thread: Re: Locks
  • Next by thread: Re: Locks
  • Index(es):
    • Date
    • Thread