-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgen.h
62 lines (48 loc) · 1.59 KB
/
pgen.h
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
61
62
//
// pgen.h -- global variables & function definitions for pgen.c.
//
// Some variables used in Pgen's functions are not exposed to avoid potential
// conflicts.
//
// $RCSfile: pgen.h,v $
//
// $Date: 2013/11/29 21:47:23 $
//
// $Author: chuck $
//
// $Id: pgen.h,v 1.1 2013/11/29 21:47:23 chuck Exp $
//
//
// ChangeLog:
//
// $Log: pgen.h,v $
// Revision 1.1 2013/11/29 21:47:23 chuck
// Initial revision
//
//
//
#ifndef _havepgenh_
#define _havepgenh_
// PgenInit() -- Initialize the Pgen multi-thread safe layer
int PgenInit();
// PgenSkipto() -- Skip ahead from the current P to the supplied P
int PgenSkipto(uint64_t);
// PgenNext(Tid) -- Using the caller's Thread Id (Tid), mark the currently 'pending'
// P for that thread as done and issue the next in line to do.
// ALSO: Perform any housekeeping which is needed to keep sync.
uint64_t PgenNext(int);
// PgenLowtide() -- Return the lowest P known to be complete of all running threads
uint64_t PgenLowtide();
#ifdef _am_pgen_internals_h_
// Pgen's single thread control mutex
static pthread_mutex_t PgenLock = PTHREAD_MUTEX_INITIALIZER;
// The PG counting / maintaining instance;
static primegen PG;
// How many threads have been initialized for (this must be >= number of real threads)
static int PgenNumThreads;
// Pgen 'lowtide' (completed) values
static uint64_t Lowtide[MAXTHREADS];
// Pgen 'hightide' (pending) values
static uint64_t Hightide[MAXTHREADS];
#endif // _am_pgen_internals_h_
#endif // _havepgenh_