Next: Timer manipulation
Up: Available routines in the
Previous: Message delivering
  Contents
- NAME
- : create_message, copy_message, insert_queue, extract_queue, insert_queue_last - Message and message queue manipulation
- SYNTAX
- :
MESSAGE *create_message ( )
MESSAGE *copy_message ( MESSAGE *m )
insert_queue ( MESSAGE **q, MESSAGE *m )
MESSAGE *extract_queue ( MESSAGE **q )
insert_queue_last ( MESSAGE *m, MESSAGE **q )
- DESCRIPTION
- :
- create_message returns a pointer to a new message. Memory is allocated for it and its fields are initialized to zero except from the field from, which is set equal to me (process id).
- copy_message returns a copy of message m. Only the user-specified fields are copied ( kind, hops, maxhops, value[]), while from is set to me.
- insert_queue inserts message m into queue *q, where messages are placed in ascending order according to field time. Messages from the same process are placed in the order they arrive because messages can not overrun each other during their propagation over a link. It is used mainly by message delivering routines ( send_to, etc.).
- extract_queue extracts a message from the front of queue *q and returns a pointer to it. If the queue is empty returns NULL.
- insert_queue_last inserts message m at the end of queue *q changing appropriatelly its field time. If the queue is empty then
, where delay is a possible propagation time over a link. It also creates the corresponding event RECMES.
- DIAGNOSTICS
- If create_message cannot allocate memory for a new message, an error message is printed and the execution is aborted.
SEE ALSO: System structure (Section 5.2), Simulator model (Section 4.1) and Message.h.
Next: Timer manipulation
Up: Available routines in the
Previous: Message delivering
  Contents
Ha Hoai Phuong
2002-11-11