-
Notifications
You must be signed in to change notification settings - Fork 28
/
lcrq.h
51 lines (41 loc) · 1.15 KB
/
lcrq.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
// Copyright (c) 2014, the Scal Project Authors. All rights reserved.
// Please see the AUTHORS file for details. Use of this source code is governed
// by a BSD license that can be found in the LICENSE file.
// This is a wrapper around the upstream implementation of LCRQ. The files
// reside in
// datastructures/upstream/lcrq
//
// The upstream files provide an implementation for:
//
// Fast Concurrent Queues for x86 Processors. Adam Morrison and Yehuda Afek.
// PPoPP 2013.
//
// Website: http://mcg.cs.tau.ac.il/projects/lcrq/, accesed 01/28/2015
#ifndef SCAL_DATASTRUCTURES_LCRQ_H_
#define SCAL_DATASTRUCTURES_LCRQ_H_
#include "datastructures/queue.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void lcrq_init();
bool lcrq_enqueue(uint64_t item);
bool lcrq_dequeue(uint64_t* item);
#ifdef __cplusplus
}
#endif // __cplusplus
namespace scal {
template<typename T>
class LCRQ : public Queue<T> {
public:
inline LCRQ() {
lcrq_init();
}
inline bool enqueue(T item) {
return lcrq_enqueue(item);
}
inline bool dequeue(T* item) {
return lcrq_dequeue(item);
}
};
} // namespace scal
#endif // SCAL_DATASTRUCTURES_LCRQ_H_