Hi Chris,

On Mon, Oct 1, 2018 at 7:39 PM Christopher Collins <ch...@runtime.io> wrote:

> Hi Andrzej,
>
> On Sun, Sep 30, 2018 at 08:27:19PM +0200, Andrzej Kaczmarek wrote:
> > I guess device can be powered off simply as a power saving option or
> > shipping mode so perhaps 'reason' parameter could be added to shutdown
> > call. I do not know if it really matters to any package whether we
> shutdown
> > to reset device or just to power it off, but single extra parameter won't
> > hurt.
>
> Good idea.
>
> > Return codes feel like a bit more intuitive way to do this. You don't
> > really need to use branching in shutdown code, I think of two other ways
> to
> > do this:
> > 1. create array of pointers to functions and then main shutdown code can
> > call each function and examine return codes (or, a bit more complicated
> > way, create new section where these pointers are places and shutdown code
> > can also iterate them as array)
>
> Another good idea.  I will try it out and report back!
>
> > 2. just return logical "or" of all return codes from all shutdown
> functions
> > - zero means shutdown is complete, non-zero means it's in progress (you
> can
> > make it a bitmask in case there's need to distinguish few status codes)
>
> I am having a hard time seeing how this would work.  A logical-or of the
> return codes would only tell us if at least one subprocedure is still in
> progress.  This is not enough information; we need to know exactly how
> many are still in progress so that we can determine when they have all
> completed (i.e., when the counter reaches 0).  Are you envisioning a
> solution that does not require a counter?
>

Ah, you're absolutely right. I forgot that we need to know how many
subprocedures are pending. So this option is not a solution here.

Chris
>

Best,
Andrzej

Reply via email to