MCPcopy Create free account
hub / github.com/bshoshany/thread-pool / flag_class

Class flag_class

tests/BS_thread_pool_test.cpp:1118–1215  ·  view source on GitHub ↗

* @brief A class to facilitate checking that member functions of different types have been successfully submitted. */

Source from the content-addressed store, hash-verified

1116 * @brief A class to facilitate checking that member functions of different types have been successfully submitted.
1117 */
1118class [[nodiscard]] flag_class
1119{
1120public:
1121 explicit flag_class(BS::thread_pool<>& pool_) : pool(&pool_) {}
1122
1123 void set_flag_no_args()
1124 {
1125 flag = true;
1126 }
1127
1128 void set_flag_one_arg(const bool arg)
1129 {
1130 flag = arg;
1131 }
1132
1133 [[nodiscard]] bool set_flag_no_args_return()
1134 {
1135 return (flag = true);
1136 }
1137
1138 [[nodiscard]] bool set_flag_one_arg_return(const bool arg)
1139 {
1140 return (flag = arg);
1141 }
1142
1143 [[nodiscard]] bool get_flag() const
1144 {
1145 return flag;
1146 }
1147
1148 void detach_test_flag_no_args()
1149 {
1150 pool->detach_task(
1151 [this]
1152 {
1153 set_flag_no_args();
1154 });
1155 pool->wait();
1156 check(get_flag());
1157 }
1158
1159 void detach_test_flag_one_arg()
1160 {
1161 pool->detach_task(
1162 [this]
1163 {
1164 set_flag_one_arg(true);
1165 });
1166 pool->wait();
1167 check(get_flag());
1168 }
1169
1170 void submit_test_flag_no_args()
1171 {
1172 pool->submit_task(
1173 [this]
1174 {
1175 set_flag_no_args();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected