Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BrodyHiggerson opened this issue Mar 16, 2020 · 0 comments

Comments

@BrodyHiggerson
Copy link
Collaborator

BrodyHiggerson commented Mar 16, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant