-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMacros.cpp
More file actions
31 lines (24 loc) · 747 Bytes
/
Macros.cpp
File metadata and controls
31 lines (24 loc) · 747 Bytes
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
#include <iostream>
#include <memory>
#include "parallel.h"
class SafeWS {
public:
bool threadSafe() const { return true; }
};
class UnsafeWS {
public:
bool threadSafe() const { return false; }
};
int main() {
auto ws4 = std::make_shared<SafeWS>();
auto ws5 = std::make_shared<UnsafeWS>();
bool test1 = ThreadSafe(ws4.get());
bool test2 = ThreadSafe(ws5.get());
bool test3 = ThreadSafe(ws4.get(), ws4.get());
bool test4 = ThreadSafe(ws4.get(), ws5.get());
bool test5 = ThreadSafe(ws4.get(), ws4.get(), ws4.get());
bool test6 = ThreadSafe(ws4.get(), ws4.get(), ws5.get());
std::cout << test1 << " " << test3 << " " << test5 << std::endl;
std::cout << test2 << " " << test4 << " " << test6 << std::endl;
return 0;
}