Welcome, Guest. Please login or register.

Author Topic: No need for Semaphore when data size is <= 32 bit ?  (Read 3815 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show all replies
Re: No need for Semaphore when data size is <= 32 bit ?
« on: May 01, 2006, 02:39:34 PM »
@Karlos

Certain operations are atomic. For example if you wish to set flags
atomically you can have:

or.l #1, 4(a4)

This operation is never interrupted and there is nobody else who would modify data in between. Of course this works in assembler only because C compiler might not work this way.
My Amigas: A500, Mac Mini and PowerBook
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show all replies
Re: No need for Semaphore when data size is <= 32 bit ?
« Reply #1 on: May 01, 2006, 02:43:56 PM »
That is, normally in C you would use something like

Forbid()
globalflags |= 1;
Permit()

when in 68k assembler coder can use single or.l instruction without Forbid()/Permit() arbitration.

This is sometimes used when dealing with Intuition windows.
My Amigas: A500, Mac Mini and PowerBook
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show all replies
Re: No need for Semaphore when data size is <= 32 bit ?
« Reply #2 on: May 01, 2006, 09:40:27 PM »
@Jose & SamuraiCrow

It is possible implement atomically incrementing counter in PPC asm without using Forbid()/Permit() or Semaphore arbitration. But better use other more portable methods than asm.
My Amigas: A500, Mac Mini and PowerBook