vxworks - taskVarAdd used twice for the same variable -


I have a global structure in my work using the WorkWorks API (API).

But during some scenarios, the same global structure is added to the same task which again uses the Action API. [I.e., the functioning person () is called twice from the job for the same variable.)

This structure will retain the work ID, message q id

for that link The following sample program is written by Benoit to explain the scenario;

int v1;

void tvl ()

{

int i = 0;

v1 = 1;

Add Taskware (0, and V1);

v1 = 2;

TaskWire (0, & amp; V1);

v1 = 3;

Weekday (1);

printf ("initial v1 =% d \ n", v1); For

(i = 0; i <10; i ++)

{

v1 ++; TaskDelay (60); Printf ("v1 =% d \ n", v1);

}

}

When I tested the code using Ternado and every time I run my program, - Getting different result

// First attempt -> TV1

Inital v1 = V1 = 3

V1 = 3

V1 = 2

V1 = 4

V1 = 4

V1 = 3

V1 = 5

V1 = 5

V1 = 5

V1 = 6

// second attempt

-> TV1

inital v1 = v1 = 1

V1 = 3

V1 = 4

V1 = 2

V1 =

V1 = 5

When I Second Work () I got it and tested it, then I am getting it

// first attempt

-> TV 1

inital v1 = 3

< P> V1 = 4

V1 = 6

V1 = 7

V1 = 8

V1 = 9

V1 = 10

V1 = 11

V1 = 12

V1 = 13

// second attempt

-> TV1

inital v1 = 3

V1 = 4

V1 = 5

P>

V1 = 11 <

V1 = 12

V1 = 13

We are using VxWork 5.5

< P> My question:

  1. What is the same task for the same task? Two TaskWireAid () The right to use?

  2. If two TaskWireAid () is used for the same variable within the same work then what will be the behavior?

  3. Please flow your program

I have to say that it is not to add the program twice to the right add:

  1. First of all, the implementation of vxworks was not handled by this situation. (I checked the vxworks source, when there is only one address of two operations, set it twice, which will get the value wrong. As vxworks is a near source, I am not going to paste the source here, but it vxworks 'Implementation makes it wrong)

  2. Second, why do you need to add twice? Work Edgar makes a task private for the current work, when the work stops, the value can be saved in the TCB of the work; And when the job switches back, the value of the private address will be copied back. So separate work would be different in the same address.

  3. The vxworks applies the action mechanism by adding switch hooks to the task of saving / saving the work of the task, which do the same routine, but separately Work can be run in context, at the same address can have different private values.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -