lib/sema.txt
author Mario de Sousa <msousa@fe.up.pt>
Tue, 22 Jan 2013 16:07:49 +0000
changeset 805 b737cfc92614
parent 251 5e7457efbb8f
permissions -rw-r--r--
Use simple_spec_init_c inside en_param_declaration_c (will reduce need to handle it as a special case in the future).
(*
 * (c) 2011 Edouard Tisserant
 *
 * Fake semaphore support, for non preemptive implementation.
 *
 *)


FUNCTION_BLOCK SEMA
  VAR_INPUT
    CLAIM : BOOL;
    RELEASE : BOOL;
  END_VAR
  VAR_OUTPUT
    BUSY : BOOL;
  END_VAR
  VAR
    Q_INTERNAL : BOOL;
  END_VAR

  Q_INTERNAL := CLAIM OR ( Q_INTERNAL AND (NOT RELEASE));
  BUSY := Q_INTERNAL;

END_FUNCTION_BLOCK