From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,d819a2b986ca3c01,start X-Google-Attributes: gidf678f,public From: alex@array.arraycomm.com (Alexandre Gonthier) Subject: problems with pthread_{attr_}setprio on OSF 2.0? Date: 1995/04/22 Message-ID: #1/1 X-Deja-AN: 101362143 sender: usenet@arraycomm.com x-nntp-posting-host: array.arraycomm.com organization: ArrayComm, Inc. keywords: pthread_setprio, pthread_attr_setprio newsgroups: comp.unix.osf.misc Hi, I am trying to use the pthreads library on axp-osf version 2.0. I wrote a short test program attached. A few problems occur during execution: 1) Even though "taskAttributes" is set to spawn "task" with a new priority, the actual priority is that of "main". 2) pthread_setprio is not implemented apparently since we get the error message: task: pthread_setprio error: Function not implemented So how can I assign a priority to a thread ??? 3) The "main" code seems to be considered as a thread (it has got an ID, etc. ) BUT, when its last instruction is reached, the program terminates even if the "task" thread hasn't executed. This motivates the infinite loop at the end. What do you think about these problems ? Are you aware of problems with this library in general ? Thanks for your help, Alex --------------------------------------------------------------------- #include #include #include #include pthread_startroutine_t task() { printf("task: my prio is: %d\n", pthread_getprio(pthread_self())); if ( pthread_setprio(pthread_self(), PRI_FG_MAX_NP) == -1 ) perror("task: pthread_setprio error"); return (pthread_startroutine_t)0; } int main(int argc, char **argv) { pthread_t threadID; pthread_addr_t dummy; pthread_attr_t taskAttributes; if ( pthread_attr_create(&taskAttributes) == -1 ) perror("main: pthread_attr_create"); if ( pthread_attr_setprio(&taskAttributes, PRI_FG_MAX_NP) == -1 ) perror("main: pthread_attr_setprio error"); pthread_create(&threadID, taskAttributes, (pthread_startroutine_t)task, dummy); printf("\n"); #if 1 while (1) {} #endif printf("main here\n"); return 0; } ----------------------------------------------------------------------