Ada's SELECT in C
Joel Sherrill
joel.sherrill at OARcorp.com
Fri Mar 1 17:01:36 UTC 2002
Pattara Kiatisevi wrote:
>
> On Fri, 1 Mar 2002, Joel Sherrill wrote:
>
> >
> >
> > Pattara Kiatisevi wrote:
> > >
> > > Ok, I get it worked with pthread now, code is much longer and more
> > > complex). But hmm, now I can't find the libpthread.a for
> > > SPARC/LEON....does it exist?
> >
> > If you configured RTEMS with --enable-posix, then it is in the
> > main RTEMS library. You should link against it by default.
>
> If I can find the /opt/rtems/sparc-rtems/include/pthread.h then it might
> mean that it was compiled using --enable-posix? Hmm but how can I link it?
Unfortunately pthread.h is always there because newlib owns it. :)
I think a better file to look for would be mutex.h. It does
look like your RTEMS was configured and installed with POSIX
disabled though.
> $ make player-tsim
> sparc-rtems-gcc -static -O2 -DTSIM -rtems -DRTEMS
> -I/usr/local/rtems/sparc-rtems/include
> -I/home/pattara/thesis/vorbis/libvorbis-1.0rc3/include/
> -I/home/pattara/thesis/vorbis/libogg-1.0rc3/include/
> sparc-rtems-fpu/libvorbis.a -L/usr/local/rtems/sparc-rtems/lib/ -lm
> sparc-rtems-fpu/libogg.a /usr/local/rtems/sparc-rtems/lib/libc.a -o
> player-tsim player.c
> /tmp/ccU6Ycyn.o: In function `playSound':
> /tmp/ccU6Ycyn.o(.text+0x1fc): undefined reference to `pthread_mutex_lock'
> /tmp/ccU6Ycyn.o(.text+0x220): undefined reference to
> `pthread_mutex_unlock'
> /tmp/ccU6Ycyn.o: In function `playAudioTask':
> /tmp/ccU6Ycyn.o(.text+0x248): undefined reference to `pthread_mutex_lock'
> /tmp/ccU6Ycyn.o(.text+0x260): undefined reference to
> `pthread_mutex_unlock'
> /tmp/ccU6Ycyn.o(.text+0x280): undefined reference to `pthread_cond_wait'
> /tmp/ccU6Ycyn.o(.text+0x288): undefined reference to
> `pthread_mutex_unlock'
> /tmp/ccU6Ycyn.o(.text+0x290): undefined reference to `pthread_cond_signal'
> /tmp/ccU6Ycyn.o: In function `main':
> /tmp/ccU6Ycyn.o(.text+0x2dc): undefined reference to `pthread_mutex_init'
> /tmp/ccU6Ycyn.o(.text+0x2f4): undefined reference to `pthread_mutex_init'
> /tmp/ccU6Ycyn.o(.text+0x304): undefined reference to `pthread_mutex_init'
> /tmp/ccU6Ycyn.o(.text+0x318): undefined reference to `pthread_cond_init'
> /tmp/ccU6Ycyn.o(.text+0x324): undefined reference to `pthread_cond_init'
> /tmp/ccU6Ycyn.o(.text+0x33c): undefined reference to `ov_open'
> /tmp/ccU6Ycyn.o(.text+0x388): undefined reference to `pthread_create'
> /tmp/ccU6Ycyn.o(.text+0x3bc): undefined reference to `pthread_create'
> /tmp/ccU6Ycyn.o(.text+0x3e4): undefined reference to `ov_comment'
> /tmp/ccU6Ycyn.o(.text+0x3f4): undefined reference to `ov_info'
> /tmp/ccU6Ycyn.o(.text+0x47c): undefined reference to `ov_pcm_total'
> /tmp/ccU6Ycyn.o(.text+0x4a0): undefined reference to `ov_comment'
> /tmp/ccU6Ycyn.o(.text+0x4fc): undefined reference to `pthread_mutex_lock'
> /tmp/ccU6Ycyn.o(.text+0x520): undefined reference to `ov_read'
> /tmp/ccU6Ycyn.o(.text+0x538): undefined reference to
> `pthread_mutex_unlock'
> /tmp/ccU6Ycyn.o(.text+0x560): undefined reference to
> `pthread_mutex_unlock'
> /tmp/ccU6Ycyn.o(.text+0x570): undefined reference to
> `pthread_mutex_unlock'
> /tmp/ccU6Ycyn.o(.text+0x57c): undefined reference to `pthread_mutex_lock'
> /tmp/ccU6Ycyn.o(.text+0x5a0): undefined reference to `pthread_cond_signal'
> /tmp/ccU6Ycyn.o(.text+0x5ac): undefined reference to `pthread_cond_wait'
> /tmp/ccU6Ycyn.o(.text+0x5b4): undefined reference to
> `pthread_mutex_unlock'
> /tmp/ccU6Ycyn.o(.text+0x5cc): undefined reference to `ov_clear'
> /tmp/ccU6Ycyn.o(.text+0x5d8): undefined reference to `pthread_mutex_lock'
> /tmp/ccU6Ycyn.o(.text+0x5e8): undefined reference to
> `pthread_mutex_unlock'
> /tmp/ccU6Ycyn.o(.text+0x5f0): undefined reference to `pthread_cond_signal'
> /tmp/ccU6Ycyn.o(.text+0x610): undefined reference to `pthread_join'
> /tmp/ccU6Ycyn.o(.text+0x618): undefined reference to `pthread_cancel'
> /tmp/ccU6Ycyn.o(.text+0x624): undefined reference to `pthread_join'
> /tmp/ccU6Ycyn.o(.data+0x7c): undefined reference to `Init'
> collect2: ld returned 1 exit status
> make: *** [player-tsim] Fehler 1
>
> Thank you very much,
> Pattara
>
> >
> > --joel
> >
> > > Thanks,
> > > Pattara
> > >
> > > On Thu, 28 Feb 2002, Pattara Kiatisevi wrote:
> > >
> > > > 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/
> > > > ----------------------------------------------------------------------
> > > >
> > > >
> > > >
> >
> > --
> > Joel Sherrill, Ph.D. Director of Research & Development
> > joel at OARcorp.com On-Line Applications Research
> > Ask me about RTEMS: a free RTOS Huntsville AL 35805
> > Support Available (256) 722-9985
> >
> >
--
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users
mailing list