taskSpawn - VxWorks

This is a discussion on taskSpawn - VxWorks ; Hi all, I have a question related to taskSpawn . Can we pass structure pointer as one of the arguments(arg1 to arg10) in taskSpawn ?? Can any one give example ... Thanks Pallavi Kawadkar...

+ Reply to Thread
Results 1 to 4 of 4

Thread: taskSpawn

  1. taskSpawn

    Hi all,

    I have a question related to taskSpawn .
    Can we pass structure pointer as one of the arguments(arg1 to arg10)
    in taskSpawn ??
    Can any one give example ...

    Thanks
    Pallavi Kawadkar


  2. Re: taskSpawn

    pallavi.kawadkar@gmail.com wrote:
    > Can we pass structure pointer as one of the arguments(arg1 to arg10)
    > in taskSpawn ??


    Yes. Just cast a pointer to your structure as an (int). It's ugly but
    it works.




    typedef struct {
    ....
    } MyType;


    void myTask( MyType *foo ) {
    ....
    }


    MyType bar;
    taskSpawn( ...., ( FUNCPTR ) myTask, ( int ) &bar, ... );


  3. Re: taskSpawn

    Exactly what Fred suggests - but one more small and obvious point - I
    would make sure that the structure pointer you are passing is a global
    struct variable address (not local to a function otherwise it may go
    out of scope by the time the new task is activated).


  4. Re: taskSpawn

    Thanks a lot


+ Reply to Thread