pthread

Joel Sherrill joel.sherrill at OARcorp.com
Thu Mar 7 14:38:52 UTC 2002



Pattara Kiatisevi wrote:
> 
> Hi,
> 
> I'm writing a pthread program. In the header I have:
> 
> #define CONFIGURE_MAXIMUM_POSIX_THREADS 5
> #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 5
> #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 5
> 
> Then in Init() I have sth. like:n
> 
>  {
>     int task_ret;
>     task_ret = pthread_create(&audioPlay, NULL, (void *) playAudioTask,
> (void *) &taskparameter);
>     if (task_ret) {
>       perror("pthread_create: playAudioTask");
>       exit(EXIT_FAILURE);
>     }
>   }
> 
> The program exited with task_ret = 22. Anybody has the idea what this "22"
> means? Do I have to set any #define more in order to have pthread function
> worked?


You probably want to use strerror or perror on the exit paths.  But
see /opt/rtems/CPU-rtems/include/sys/errno.h for the mapping.  This
is EINVAL.  Unfortunately, that is a catch all error in in POSIX.
The only real error it doesn't cover is not configuring enough
pthreads.  I hate to suggest this but you would be better off
tracing into the call or at least reading the pthreadcreate.c
source and see if something rings a bell.   Here is the URL
for the man page which lists the conditions for EINVAL:

http://www.oarcorp.com/rtemsdoc-4.5.1-pre3/rtemsdoc/html/posix_users/posix_users00344.html

> Thank you very much,

POSIX makes figuring out what is wrong with a call tough.  
I don't see anything obvious myself.

> 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



More information about the users mailing list