Skip to content

Commit

Permalink
updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajmund Szymanski committed May 2, 2018
1 parent 6405e2e commit 8419faf
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 25 deletions.
5 changes: 3 additions & 2 deletions examples/EventQueue.cpp_
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ void slave()

void master()
{
unsigned x = 15;
unsigned x = 1;

for (;;)
{
ThisTask::delay(SEC);
evq.give(x++);
evq.give(x);
x = (x << 1) | (x >> 3);
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/MailBoxQueue.cpp_
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ void slave()

void master()
{
unsigned x = 15;
unsigned x = 1;

for (;;)
{
ThisTask::delay(SEC);
box.give(&x);
x++;
x = (x << 1) | (x >> 3);
}
}

Expand Down
5 changes: 3 additions & 2 deletions examples/MemoryPool.cpp_
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ void slave()
void master()
{
unsigned*p;
unsigned x = 15;
unsigned x = 1;

for (;;)
{
ThisTask::delay(SEC);

mem.wait(&p);
*p=x++;
*p=x;
lst.give(p);
x = (x << 1) | (x >> 3);
}
}

Expand Down
6 changes: 3 additions & 3 deletions examples/MessageBuffer.cpp_
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ void slave()

void master()
{
unsigned x = 15;
unsigned x = 1;

for (;;)
{
ThisTask::delay(SEC);
msg.send(&x, sizeof(x));
x++;
msg.give(&x, sizeof(x));
x = (x << 1) | (x >> 3);
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/StreamBuffer.cpp_
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ void slave()

void master()
{
unsigned x = 15;
unsigned x = 1;

for (;;)
{
ThisTask::delay(SEC);
stm.send(&x, sizeof(x));
x++;
x = (x << 1) | (x >> 3);
}
}

Expand Down
5 changes: 3 additions & 2 deletions examples/event_queue-1.c_
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ void slave()

void master()
{
unsigned x = 15;
unsigned x = 1;

for (;;)
{
tsk_delay(SEC);
evq_give(evq, x++);
evq_give(evq, x);
x = (x << 1) | (x >> 3);
}
}

Expand Down
5 changes: 3 additions & 2 deletions examples/event_queue-2.c_
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ void slave()

void master()
{
unsigned x = 15;
unsigned x = 1;

for (;;)
{
tsk_delay(SEC);
evq_give(&evq, x++);
evq_give(&evq, x);
x = (x << 1) | (x >> 3);
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/mailbox_queue-1.c_
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ void slave()

void master()
{
unsigned x = 15;
unsigned x = 1;

for (;;)
{
tsk_delay(SEC);
box_give(box, &x);
x++;
x = (x << 1) | (x >> 3);
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/mailbox_queue-2.c_
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ void slave()

void master()
{
unsigned x = 15;
unsigned x = 1;

for (;;)
{
tsk_delay(SEC);
box_give(box, &x);
x++;
x = (x << 1) | (x >> 3);
}
}

Expand Down
5 changes: 3 additions & 2 deletions examples/memory_pool.c_
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ void slave()
void master()
{
void *p;
unsigned x = 15;
unsigned x = 1;

for (;;)
{
tsk_delay(SEC);
mem_wait(mem, &p);
*(unsigned *)p = x++;
*(unsigned *)p = x;
lst_give(lst, p);
x = (x << 1) | (x >> 3);
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/message_buffer.c_
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ OS_TSK_DEF(sla)

OS_TSK_DEF(mas)
{
unsigned x = 15;
unsigned x = 1;

for (;;)
{
tsk_delay(SEC);
msg_give(msg, &x, sizeof(x));
x++;
x = (x << 1) | (x >> 3);
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/stream_buffer.c_
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ OS_TSK_DEF(sla)

OS_TSK_DEF(mas)
{
unsigned x = 15;
unsigned x = 1;

for (;;)
{
tsk_delay(SEC);
stm_send(stm, &x, sizeof(x));
x++;
x = (x << 1) | (x >> 3);
}
}

Expand Down

0 comments on commit 8419faf

Please sign in to comment.