-
Notifications
You must be signed in to change notification settings - Fork 42
/
linkedlist-lock.h
81 lines (70 loc) · 2.15 KB
/
linkedlist-lock.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* File: linkedlist-lock.h
* Author: Vincent Gramoli <[email protected]>,
* Vasileios Trigonakis <[email protected]>
* Description:
* linkedlist-lock.h is part of ASCYLIB
*
* Copyright (c) 2014 Vasileios Trigonakis <[email protected]>,
* Tudor David <[email protected]>
* Distributed Programming Lab (LPD), EPFL
*
* ASCYLIB is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2
* of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _H_LINKEDLIST_LOCK_
#define _H_LINKEDLIST_LOCK_
#include <assert.h>
#include <getopt.h>
#include <limits.h>
#include <pthread.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <time.h>
#include <stdint.h>
#include <atomic_ops.h>
#include "lock_if.h"
#include "optik.h"
#include "common.h"
#include "utils.h"
#include "measurements.h"
#include "ssalloc.h"
#include "ssmem.h"
#define DEFAULT_LOCKTYPE 2
#define DEFAULT_ALTERNATE 0
#define DEFAULT_EFFECTIVE 1
static volatile int stop;
extern __thread ssmem_allocator_t* alloc;
typedef volatile struct node_l
{
skey_t key; /* 8 */
sval_t val; /* 16 */
volatile struct node_l *next; /* 24 */
optik_t lock;
#if defined(DO_PAD)
uint8_t padding[CACHE_LINE_SIZE - sizeof(skey_t) -
sizeof(sval_t) - sizeof(struct node*) - sizeof(optik_t)];
#endif
} node_l_t;
STATIC_ASSERT(sizeof(node_l_t) == 32, "sizeof(node_l_t) == 32");
typedef ALIGNED(CACHE_LINE_SIZE) struct intset_l
{
node_l_t* head;
uint8_t padding[CACHE_LINE_SIZE - sizeof(node_l_t*)];
} intset_l_t;
node_l_t* new_node_l(skey_t key, sval_t val, node_l_t* next, int initializing);
intset_l_t* set_new_l();
void set_delete_l(intset_l_t* set);
int set_size_l(intset_l_t* set);
void node_delete_l(node_l_t* node);
#endif /* _H_LINKEDLIST_LOCK_ */