Is it possible to start a task individually?

Hey all,

Is it was possible to start a task individually (without vTaskStartScheduler)? Was thinking about the FreeRTOS equivalent to RTEMS’ rtems_task_start(). I’ve done some digging, but it doesn’t seem possible yet, maybe there’s a way to go about it with threads?

Cheers!

Either the scheduler is running or it isn’t. Not sure what you are expecting to happen.

Just invoke the task function in main :wink: maybe using a wrapper. What do you mean with threads ?
I wonder which use case is addressed by starting a single task without any scheduling :thinking:

Hmmm, giving us quite a riddle here? Maybe you’re thinking about the feature some RTOS’s provide that allow you to create a task suspended and trigger it explicitly. That’s easily done in FreeRTOS by having your task call vTaskSuspend(NULL) before doing anything else and then resume it explicitly from somewhere else.

So what’s the solution? What do you want the system to accomplish here? Inquiring minds would certainly like to know… :kissing_smiling_eyes:

I guess for context, what I’m attempting to do is port a library for FreeRTOS, and that task creation method involves also starting the task. I’m not quite sure how it’ll be used yet, but if it isn’t possible, I’ll just have to adjust the implementation.

Maybe creating (and starting) a “mother” task first, then creating “child” tasks inside (so they start automatically) would be how to go about it?

Or maybe the question becomes how do I create a new task and run it while the scheduler is active?

Thanks for the replies :slight_smile:

I’m using a main task setting up everything else including child tasks. For me it’s a good approach doing nothing in main except creating the root/parent task and start the scheduler.

What makes you think this isn’t possible ? You can create tasks whenever you want.

I was under the impression when vTaskStartScheduler() is called, nothing after it is called unless the scheduler is stopped, then started again. Unless it’s creating tasks within tasks, is there another way of going about it?

Uhm … no. As documented vTaskStartScheduler is a point of no return.
I’d go the way with a main task and you’ll be fine.

1 Like