Re: RFC: make _fiber_start() return a handle on the fiber


Benjamin Walsh <benjamin.walsh@...>
 

On Fri, Feb 19, 2016 at 08:12:04AM -0800, Dirk Brandewie wrote:


On 02/16/2016 11:34 AM, Benjamin Walsh wrote:
Folks,

When we start a fiber via the _fiber_start() API family, we don't get
back a handle on the created fiber. The fiber identifier is actually the
start of the fiber's stack. This hasn't been a problem until now since
no API requires a handle on the fiber, except one,
fiber_delayed_start_cancel(): that API is part of a pair, where the
other API, fiber_delayed_start() starts the fiber and returns a handle.

However, Jukka asked me an API could be created that cancels a
fiber_sleep() call, something like fiber_wakeup(). The implementation of
such an API is very simple, but it requires a handle on the fiber we
want to wake up. This in turn requires the signature of the
_fiber_start() family to return a handle to the fiber that gets started.

The signature of _fiber_start() et al. would then change from a void
return type to a void * return type.
Makes sense but why not tell the compiler the truth about the type?
Ugh, you're right, it's a nano_thread_id_t.

Join {devel@lists.zephyrproject.org to automatically receive all group messages.