title: Event handling in embedded code
body: <p>I want to know how events are used in embedded system code.</p>
  
  <p>Main intention is to know how exactly event flags are set/reset in code. and how to identify which task is using which event flag and which bits of the flag are getting set/reset by each task.</p>
  
  <p>Please put your suggestion or comments about it.</p>
  
  <p>Thanks in advance.</p>
  
  <hr>
  
  <p>(edit 1: copied from clarification in answer below)</p>
  
  <p>Sorry for not specifying the details required. Actually I am interested in the analysis of any application written in C language using vxworks/Itron/OSEK OS. For example there is eventLib library in vxworks to support event handling. I want to know that how one can make use of such system routines to handle events in task. What is event flag(is it global/local...or what ?), how to set bits of any event flag and which can be the possible relationship between task and event flags ??</p>
  
  <p>How task can wait for multiple events in AND and OR mode ??
  I came across one example in which the scenario given below looks dangerous, but why ??</p>
  
  <pre><code>            Scenarios is ==&gt; *[Task1 : Set(e1), Task2 : Wait(e1) and Set(e2), Task3 : Wait(e2) ]*                                             
  </code></pre>
  
  <p>I know that multiple event flags waited by one task or circular dependency between multiple tasks(deadlock) are dangerous cases in task-event relationship, but how above scenario is dangerous, I am not getting it....Kindly explain.</p>
  
  <pre><code>                (Are there any more such scenarios possible in task-event handling which should be reviewed in code ?? ) 
  </code></pre>
  
  <p>I hope above information is sufficient ....</p>