Skip to content

Commit

Permalink
Synchronous 'async' and 'schedule' on internal tasking system
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslawpawlowski committed Sep 26, 2024
1 parent 1d44f0d commit fdc2a27
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
23 changes: 0 additions & 23 deletions rkcommon/tasking/detail/TaskSys.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,6 @@ namespace rkcommon {
scheduleTaskInternal(&task);
waitInternal(&task);
}

template <typename TASK_T>
inline void schedule_internal(TASK_T &&fcn)
{
struct LocalTask : public Task
{
TASK_T t;

LocalTask(TASK_T &&fcn) : Task(1), t(std::forward<TASK_T>(fcn)) {}

~LocalTask() override = default;

void ExecuteRange(enki::TaskSetPartition, uint32_t) override
{
t();
delete this;
}
};

auto *task = new LocalTask(std::forward<TASK_T>(fcn));
scheduleTaskInternal(task);
}

} // namespace detail
} // namespace tasking
} // namespace rkcommon
4 changes: 1 addition & 3 deletions rkcommon/tasking/detail/schedule.inl
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ namespace rkcommon {
#elif defined(RKCOMMON_TASKING_OMP)
std::thread thread(fcn);
thread.detach();
#elif defined(RKCOMMON_TASKING_INTERNAL)
detail::schedule_internal(std::move(fcn));
#else// Debug --> synchronous!
#else// Internal & Debug --> synchronous!
fcn();
#endif
}
Expand Down

0 comments on commit fdc2a27

Please sign in to comment.