Skip to content

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

@BrodyHiggerson

Description

@BrodyHiggerson

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions