Ada's SELECT in C

Pattara Kiatisevi pkiatisevi at student.ei.uni-stuttgart.de
Thu Feb 28 17:45:56 UTC 2002


Hi,

I have a not-so-directly-involved-with-RTEMS question but just ask for
conceptual idea. As I learnt the syntax "SELECT" in ADA and now have to
program with pthread on RTEMS. Anybody knows how to translate the
following snippet of psuedo code into pthread's concept?

buffer_t buffer[xxx];
task Player;

main {
  int currentbuffer = 0;
  Create and run Player task;
  while(input not EOF) {
    decode_music_from_input_to(buffer[currentbuffer]);
    Play.goPlay(currentbuffer); // Block if Player is still busy
    Change value of currentbuffer to whatever e.g. +=1
  }
  play.stop();
}

Player {
  forever {
   Select
     Accept Stop() : exit ;
     Accept Goplay(currentbuffer) :  // only this line in rendezvous
       Outputsound(buffer[currentbuffer]);
       //this output sound could block
   End Select;
  }
}

Thank you for all the answer(s),
Pattara
--
Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
----------------------------------------------------------------------
Ott Pattara Kiatisevi 				   T L W G
M.Sc. INFOTECH Student, Stuttgart, Germany	http://linux.thai.net/
----------------------------------------------------------------------




More information about the users mailing list