tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ptst.h
Go to the documentation of this file.
1 /******************************************************************************
2  * ptst.h
3  *
4  * Per-thread state management.
5  *
6  * Copyright (c) 2002-2003, K A Fraser
7  */
8 
9 #ifndef __PTST_H__
10 #define __PTST_H__
11 
12 typedef struct ptst_st ptst_t;
13 
14 #include "gc.h"
15 #include "random.h"
16 
17 struct ptst_st
18 {
19  /* Thread id */
20  unsigned int id;
21 
22  /* State management */
24  unsigned int count;
25  /* Utility structures */
26  gc_t *gc;
28 };
29 
30 extern pthread_key_t ptst_key;
31 
32 /*
33  * Enter/leave a critical region. A thread gets a state handle for
34  * use during critical regions.
35  */
37 #define fr_critical_exit(_p) fr_gc_exit(_p)
38 
39 /* Iterators */
40 extern ptst_t *ptst_list;
41 #define ptst_first() (ptst_list)
42 #define ptst_next(_p) ((_p)->next)
43 
44 /* Called once at start-of-day for entire application. */
45 void fr_init_ptst_subsystem(void);
46 
47 #endif /* __PTST_H__ */
rand_t rand
Definition: ptst.h:27
Definition: ptst.h:17
ptst_t * next
Definition: ptst.h:23
gc_t * gc
Definition: ptst.h:26
pthread_key_t ptst_key
Definition: ptst.c:32
ptst_t * ptst_list
Definition: ptst.c:33
unsigned int count
Definition: ptst.h:24
void fr_init_ptst_subsystem(void)
Definition: ptst.c:86
Definition: gc.c:133
ptst_t * fr_critical_enter(void)
Definition: ptst.c:37
unsigned int id
Definition: ptst.h:20