How do I detect that I'm running in the interrupt context? - VxWorks

This is a discussion on How do I detect that I'm running in the interrupt context? - VxWorks ; Does anybody know how can I detect that I'm inside interrupt context? I have a function that is called from different places and I'd like to add to it something like if (taskIsInterrupt()) { .. .. .. } else { ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: How do I detect that I'm running in the interrupt context?

  1. How do I detect that I'm running in the interrupt context?

    Does anybody know how can I detect that I'm inside interrupt context?
    I have a function that is called from different places and I'd like to
    add to it something like

    if (taskIsInterrupt())
    {
    ..
    ..
    ..
    }
    else
    {
    ..
    ..
    ..
    }

    Thank you


  2. Re: How do I detect that I'm running in the interrupt context?

    FireAphis@gmail.com wrote:

    >Does anybody know how can I detect that I'm inside interrupt context?
    >I have a function that is called from different places and I'd like to
    >add to it something like
    >
    >if (taskIsInterrupt())
    >{
    >.
    >.
    >.
    >}
    >else
    >{
    >.
    >.
    >.
    >}


    My first thought was taskIdSelf() and, sure enough, taskIdSelf() is
    documented to return an invalid task ID if called from the interrupt
    level.

    Does anybody know for certain what constitutes an invalid task ID?

    >Thank you


    HTH

    --
    ================================================== ======================
    Michael Kesti | "And like, one and one don't make
    | two, one and one make one."
    mrkesti at hotmail dot com | - The Who, Bargain

  3. Re: How do I detect that I'm running in the interrupt context?

    On Jun 18, 7:43 am, "Michael R. Kesti"
    wrote:
    > FireAp...@gmail.com wrote:
    > >Does anybody know how can I detect that I'm inside interrupt context?
    > >I have a function that is called from different places and I'd like to
    > >add to it something like

    >
    > >if (taskIsInterrupt())
    > >{
    > >.
    > >.
    > >.
    > >}
    > >else
    > >{
    > >.
    > >.
    > >.
    > >}

    >
    > My first thought was taskIdSelf() and, sure enough, taskIdSelf() is
    > documented to return an invalid task ID if called from the interrupt
    > level.
    >
    > Does anybody know for certain what constitutes an invalid task ID?
    >
    > >Thank you

    >
    > HTH
    >
    > --
    > ================================================== ======================
    > Michael Kesti | "And like, one and one don't make
    > | two, one and one make one."
    > mrkesti at hotmail dot com | - The Who, Bargain- Hide quoted text -
    >
    > - Show quoted text -


    NAME
    intContext( ) - determine if the current state is in interrupt or task
    context

    SYNOPSIS

    BOOL intContext (void)

    DESCRIPTION
    This routine returns TRUE only if the current execution state is in
    interrupt context and not in a meaningful task context.




  4. Re: How do I detect that I'm running in the interrupt context?

    On Jun 18, 8:26 am, RamSen wrote:
    > On Jun 18, 7:43 am, "Michael R. Kesti"
    > wrote:
    >
    >
    >
    > > FireAp...@gmail.com wrote:
    > > >Does anybody know how can I detect that I'm inside interrupt context?
    > > >I have a function that is called from different places and I'd like to
    > > >add to it something like

    >
    > > >if (taskIsInterrupt())
    > > >{
    > > >.
    > > >.
    > > >.
    > > >}
    > > >else
    > > >{
    > > >.
    > > >.
    > > >.
    > > >}

    >
    > > My first thought was taskIdSelf() and, sure enough, taskIdSelf() is
    > > documented to return an invalid task ID if called from the interrupt
    > > level.

    >
    > > Does anybody know for certain what constitutes an invalid task ID?

    >
    > > >Thank you

    >
    > > HTH

    >
    > > --
    > > ================================================== ======================
    > > Michael Kesti | "And like, one and one don't make
    > > | two, one and one make one."
    > > mrkesti at hotmail dot com | - The Who, Bargain- Hide quoted text -

    >
    > > - Show quoted text -

    >
    > NAME
    > intContext( ) - determine if the current state is in interrupt or task
    > context
    >
    > SYNOPSIS
    >
    > BOOL intContext (void)
    >
    > DESCRIPTION
    > This routine returns TRUE only if the current execution state is in
    > interrupt context and not in a meaningful task context.


    Thanks. I've found it myself too. And it seems to do the job.
    No more crashes because of illegal operations in the interrupt
    context :-)


+ Reply to Thread