MCPcopy Create free account
hub / github.com/apple/foundationdb / ActionWrapper

Class ActionWrapper

flow/IThreadPool.cpp:66–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64 int pri;
65
66 struct ActionWrapper {
67 PThreadAction action;
68 ActionWrapper(PThreadAction action) : action(action) {}
69 // HACK: Boost won't use move constructors, so we just assume the last copy made is the one that will be called
70 // or cancelled
71 ActionWrapper(ActionWrapper const& r) : action(r.action) { const_cast<ActionWrapper&>(r).action = nullptr; }
72 void operator()() {
73 Thread::dispatch(action);
74 action = nullptr;
75 }
76 ~ActionWrapper() {
77 if (action) {
78 action->cancel();
79 }
80 }
81 ActionWrapper& operator=(ActionWrapper const&) = delete;
82 };
83
84public:
85 ThreadPool(int stackSize, int pri) : dontstop(ios), mode(Run), stackSize(stackSize), pri(pri) {}

Callers 1

postMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected