Qt 4.8
Macros | Functions | Variables
qatomic_parisc.cpp File Reference
#include <QtCore/qglobal.h>
#include <QtCore/qhash.h>

Go to the source code of this file.

Macros

#define UNLOCKED   {-1,-1,-1,-1}
 
#define UNLOCKED128   UNLOCKED64,UNLOCKED64
 
#define UNLOCKED16   UNLOCKED8,UNLOCKED8
 
#define UNLOCKED2   UNLOCKED,UNLOCKED
 
#define UNLOCKED256   UNLOCKED128,UNLOCKED128
 
#define UNLOCKED32   UNLOCKED16,UNLOCKED16
 
#define UNLOCKED4   UNLOCKED2,UNLOCKED2
 
#define UNLOCKED64   UNLOCKED32,UNLOCKED32
 
#define UNLOCKED8   UNLOCKED4,UNLOCKED4
 

Functions

static int * align16 (int *lock)
 
int * getLock (volatile void *addr)
 
void q_atomic_lock (int *lock)
 
void q_atomic_unlock (int *lock)
 
int q_ldcw (volatile int *addr)
 

Variables

static int locks [256][4] = { UNLOCKED256 }
 

Macro Definition Documentation

◆ UNLOCKED

#define UNLOCKED   {-1,-1,-1,-1}

Definition at line 49 of file qatomic_parisc.cpp.

◆ UNLOCKED128

#define UNLOCKED128   UNLOCKED64,UNLOCKED64

Definition at line 56 of file qatomic_parisc.cpp.

◆ UNLOCKED16

#define UNLOCKED16   UNLOCKED8,UNLOCKED8

Definition at line 53 of file qatomic_parisc.cpp.

◆ UNLOCKED2

#define UNLOCKED2   UNLOCKED,UNLOCKED

Definition at line 50 of file qatomic_parisc.cpp.

◆ UNLOCKED256

#define UNLOCKED256   UNLOCKED128,UNLOCKED128

Definition at line 57 of file qatomic_parisc.cpp.

◆ UNLOCKED32

#define UNLOCKED32   UNLOCKED16,UNLOCKED16

Definition at line 54 of file qatomic_parisc.cpp.

◆ UNLOCKED4

#define UNLOCKED4   UNLOCKED2,UNLOCKED2

Definition at line 51 of file qatomic_parisc.cpp.

◆ UNLOCKED64

#define UNLOCKED64   UNLOCKED32,UNLOCKED32

Definition at line 55 of file qatomic_parisc.cpp.

◆ UNLOCKED8

#define UNLOCKED8   UNLOCKED4,UNLOCKED4

Definition at line 52 of file qatomic_parisc.cpp.

Function Documentation

◆ align16()

static int* align16 ( int *  lock)
static

Definition at line 65 of file qatomic_parisc.cpp.

Referenced by q_atomic_lock().

66 {
67  ulong off = (((ulong) lock) % 16);
68  return off ? (int *)(ulong(lock) + 16 - off) : lock;
69 }
unsigned long ulong
Definition: qglobal.h:997
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ getLock()

int* getLock ( volatile void *  addr)

Definition at line 62 of file qatomic_parisc.cpp.

63 { return locks[qHash(const_cast<void *>(addr)) % 256]; }
static int locks[256][4]
uint qHash(const QUrl &url)
Definition: qurl.h:285

◆ q_atomic_lock()

void q_atomic_lock ( int *  lock)

Definition at line 75 of file qatomic_parisc.cpp.

76  {
77  // ldcw requires a 16-byte aligned address
78  volatile int *x = align16(lock);
79  while (q_ldcw(x) == 0)
80  ;
81  }
static int * align16(int *lock)
static QReadWriteLock lock
Definition: proxyconf.cpp:399
int q_ldcw(volatile int *addr)

◆ q_atomic_unlock()

void q_atomic_unlock ( int *  lock)

Definition at line 83 of file qatomic_parisc.cpp.

84  { lock[0] = lock[1] = lock[2] = lock[3] = -1; }
static QReadWriteLock lock
Definition: proxyconf.cpp:399

◆ q_ldcw()

int q_ldcw ( volatile int *  addr)

Referenced by align16(), and q_atomic_lock().

Variable Documentation

◆ locks

int locks[256][4] = { UNLOCKED256 }
static