For exiting a bthread.
| 35 | |
| 36 | // For exiting a bthread. |
| 37 | class ExitException : public std::exception { |
| 38 | public: |
| 39 | explicit ExitException(void* value) : _value(value) {} |
| 40 | ~ExitException() throw() {} |
| 41 | const char* what() const throw() override { |
| 42 | return "ExitException"; |
| 43 | } |
| 44 | void* value() const { |
| 45 | return _value; |
| 46 | } |
| 47 | private: |
| 48 | void* _value; |
| 49 | }; |
| 50 | |
| 51 | // Refer to https://rigtorp.se/isatomic/, On the modern CPU microarchitectures |
| 52 | // (Skylake and Zen 2) AVX/AVX2 128b/256b aligned loads and stores are atomic |