Index

Cooperating Sequential Tasks

  1. Introduction
    1. Arduino
    2. Interrupts
  2. Simple Tasks
  3. Multiple Tasks
  4. Communicating Tasks
  5. Communicating Values
  6. Synchronising Tasks
  7. Buffered Communication
  8. Multiple Senders
  9. Conditional Tasks
  10. Transput
  11. Implementation
    1. Common Data
    2. Tasks
    3. task_builder
    4. task
    5. channel
    6. virtual_machine
    7. set
    8. queue
    9. clock
    10. standard
    11. Adjusting Limits

task_builder



Functions

void add_data(int value);


This function places the indicated value in the element of the code array indexed by next_code (See Common Data). The value of next_code is then set to point at the following element in the array. All of the action specification functions in the Tasks interface use this operation to add code to the code array. The values used to represent specific actions are declared in the act enumeration defined by the virtual_machine.

enum act{no_act,      simple_act,   with_arg_act, wait_act,      wait_with_arg_act, pause_act, send_act, 
         receive_act, transput_act, loop_act,     terminate_act, when_act,          repeat_act
        };


The parameters of an action specification function are stored in the code array immediately following the value representing the action. Where a parameter is not represented by an integer value, its will be cast to an integer. For example the action function in the Tasks interface is implemented as follows.

void action(action_routine routine)
{
  add_data(simple_act);
  add_data((int)routine);
}


All of the other action specification functions are implemented in a similar fashion.