FiberTaskingLib icon indicating copy to clipboard operation
FiberTaskingLib copied to clipboard

Move simple ftl types into separate header to reduce some user includes

Open BrodyHiggerson opened this issue 5 years ago • 0 comments

I have a file which contains functions to start/stop the global scheduler, and to return a forward-declared pointer to it.

It turns out that I can't avoid the include in this case, because my scheduler start function takes an ftl::EmptyQueueBehaviour enum to pass on to the scheduler. I can forward declare the enum itself but can't provide a default value without the include.

These types don't rely on anything in task_scheduler.h (other than the latter depending on the former):

enum class EmptyQueueBehavior
struct TaskSchedulerInitOptions

There is some precedent for small headers, see task.h:

#pragma once

namespace ftl {

class TaskScheduler;

using TaskFunction = void (*)(TaskScheduler *taskScheduler, void *arg);

struct Task {
	TaskFunction Function;
	void *ArgData;
};

} // End of namespace ftl

Is it worth an ftl_types.h or similar? Thoughts?

BrodyHiggerson avatar Mar 16 '20 08:03 BrodyHiggerson