Back to index

plt-scheme  4.2.1
Classes | Defines | Typedefs | Functions
specific.h File Reference
#include <errno.h>

Go to the source code of this file.


struct  thread_specific_entry
struct  thread_specific_data


#define PREFIXED(name)   GC_##name
#define TS_CACHE_SIZE   1024
#define CACHE_HASH(n)   (((((long)n) >> 8) ^ (long)n) & (TS_CACHE_SIZE - 1))
#define TS_HASH_SIZE   1024
#define HASH(n)   (((((long)n) >> 8) ^ (long)n) & (TS_HASH_SIZE - 1))
#define INVALID_QTID   ((unsigned long)0)
#define INVALID_THREADID   ((pthread_t)0)


typedef struct
typedef struct thread_specific_data tsd
typedef tsdPREFIXED (key_t)


static __inline__ unsigned long quick_thread_id ()
int PREFIXED() key_create (tsd **key_ptr, void(*destructor)(void *))
int PREFIXED() setspecific (tsd *key, void *value)
void PREFIXED() remove_specific (tsd *key)
void *PREFIXED() slow_getspecific (tsd *key, unsigned long qtid, tse *volatile *cache_entry)
static __inline__ void *PREFIXED() getspecific (tsd *key)

Class Documentation

struct thread_specific_entry

Definition at line 36 of file specific.h.

Collaboration diagram for thread_specific_entry:
Class Members
struct thread_specific_entry * next
unsigned long qtid
pthread_t thread
void * value
struct thread_specific_data

Definition at line 64 of file specific.h.

Collaboration diagram for thread_specific_data:
Class Members
tse *volatile cache
tse * hash
pthread_mutex_t lock

Define Documentation

#define CACHE_HASH (   n)    (((((long)n) >> 8) ^ (long)n) & (TS_CACHE_SIZE - 1))

Definition at line 26 of file specific.h.

#define HASH (   n)    (((((long)n) >> 8) ^ (long)n) & (TS_HASH_SIZE - 1))

Definition at line 28 of file specific.h.

#define INVALID_QTID   ((unsigned long)0)

Definition at line 61 of file specific.h.

#define INVALID_THREADID   ((pthread_t)0)

Definition at line 62 of file specific.h.


Definition at line 22 of file specific.h.

#define PREFIXED (   name)    GC_##name

Definition at line 23 of file specific.h.

#define TS_CACHE_SIZE   1024

Definition at line 25 of file specific.h.

#define TS_HASH_SIZE   1024

Definition at line 27 of file specific.h.

Typedef Documentation

typedef tsd* PREFIXED(key_t)

Definition at line 71 of file specific.h.

Function Documentation

static __inline__ void* PREFIXED() getspecific ( tsd key) [static]

Definition at line 83 of file specific.h.

    long qtid = quick_thread_id();
    unsigned hash_val = CACHE_HASH(qtid);
    tse * volatile * entry_ptr = key -> cache + hash_val;
    tse * entry = *entry_ptr;   /* Must be loaded only once.   */
    if (EXPECT(entry -> qtid == qtid, 1)) {
      GC_ASSERT(entry -> thread == pthread_self());
      return entry -> value;
    return PREFIXED(slow_getspecific) (key, qtid, entry_ptr);

Here is the call graph for this function:

int PREFIXED() key_create ( tsd **  key_ptr,
void(*)(void *)  destructor 
static __inline__ unsigned long quick_thread_id ( ) [static]

Definition at line 56 of file specific.h.

    int dummy;
    return (unsigned long)(&dummy) >> 12;

Here is the caller graph for this function:

int PREFIXED() setspecific ( tsd key,
void value 
void* PREFIXED() slow_getspecific ( tsd key,
unsigned long  qtid,
tse *volatile *  cache_entry 

Here is the caller graph for this function: