home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_12 / 8n12077a < prev    next >
Text File  |  1990-08-29  |  671b  |  25 lines

  1. /* sender.c - Sender task for synchronous communication */
  2.  
  3. #define REPLY 0
  4.  
  5. static handler Reply(msg_t *msg_ptr) { /* for synchronization only */
  6. }
  7.  
  8. task Sender(void) {
  9.     task_t self = task_self();
  10.     msg_t  msg;
  11.  
  12.     task_setHandler(1, Reply); /* this task has one handler called Reply */
  13.  
  14.     loop {
  15.         /* interrupt Receiver and wait on Reply */
  16.         msg.srcTid = self;
  17.         msg.dstTid = task_idOf("Receiver");
  18.         msg.dstHid = 0; /* Sync = Handler Id #0 */
  19.         msg.type   = msg_type_DATA;
  20.         msg.value.a = /* address of DATA */
  21.         task_interruptEnableWait(&msg, NO_TIMEOUT, 1, REPLY);
  22.         /* ... */
  23.     }
  24. }
  25.