File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ namespace {
137137 task_handle th = std::forward<F>(f)();
138138 task_handle_task* task_ptr = task_handle_accessor::release (th);
139139 // If task has unresolved dependencies, it can't be bypassed
140- if (task_ptr->has_dependencies () && !task_ptr->release_dependency ()) {
140+ if (task_ptr && task_ptr ->has_dependencies () && !task_ptr->release_dependency ()) {
141141 task_ptr = nullptr ;
142142 }
143143
Original file line number Diff line number Diff line change @@ -1172,6 +1172,16 @@ TEST_CASE("Task handle for scheduler bypass"){
11721172
11731173 tg.wait ();
11741174 CHECK_MESSAGE (run == true , " task handle returned by user lambda (bypassed) should be run" );
1175+
1176+ // Test returning an empty handle
1177+ run = false ;
1178+ tg.run ([&] {
1179+ run = true ;
1180+ return tbb::task_handle{};
1181+ });
1182+
1183+ tg.wait ();
1184+ CHECK (run == true );
11751185}
11761186
11771187// ! The test for task_handle inside other task waiting with run_and_wait
@@ -1187,6 +1197,13 @@ TEST_CASE("Task handle for scheduler bypass via run_and_wait"){
11871197 });
11881198
11891199 CHECK_MESSAGE (run == true , " task handle returned by user lambda (bypassed) should be run" );
1200+
1201+ // Test returning an empty handle
1202+ run = false ;
1203+ tg.run_and_wait ([&] {
1204+ run = true ;
1205+ });
1206+ CHECK (run == true );
11901207}
11911208#endif // __TBB_PREVIEW_TASK_GROUP_EXTENSIONS
11921209
You can’t perform that action at this time.
0 commit comments