summaryrefslogtreecommitdiff
path: root/implement.h
blob: 2a7e192301802f0e0dbbc7fefccd213b4d2eb347 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * implement.h
 *
 * Implementation specific (non API) stuff.
 */

#ifndef _IMPLEMENT_H
#define _IMPLEMENT_H

/* FIXME: Arbitrary. Need values from Win32.
 */
#define PTHREAD_THREADS_MAX 128
#define PTHREAD_STACK_MIN   65535

#define _PTHREAD_HASH_INDEX(x) (((ULONG) x) % PTHREAD_THREADS_MAX)

/* This is all compile time arithmetic */
#define RND_SIZEOF(T) (((sizeof(T) / sizeof(DWORD)) + 1) * sizeof(DWORD))


typedef struct _pthread_cleanup_stack _pthread_cleanup_stack_t;
struct _pthread_cleanup_stck {
  _pthread_cleanup_stack_t first;
  int count;
};

typedef struct _pthread_cleanup_node _pthread_cleanup_node_t;
struct _pthread_cleanup_node {
  _pthread_cleanup_node_t next;
  void (* routine)(void *);
  void * arg;
};

typedef struct {
  size_t stacksize;
} _pthread_attr_t;

typedef struct {
  /* Nothing needed yet. */
} _pthread_mutexattr_t;

typedef struct {
  /* Nothing needed yet. */
} _pthread_condattr_t;

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

void _pthread_cleanup_push(void (*routine)(void *), void *arg);
void _pthread_cleanup_pop(int execute);
void _pthread_do_cancellation(int tindex);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* _IMPLEMENT_H */