Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
* problems with pthread_{attr_}setprio on OSF 2.0?
@ 1995-04-22  4:00 Alexandre Gonthier
  0 siblings, 0 replies; only message in thread
From: Alexandre Gonthier @ 1995-04-22  4:00 UTC (permalink / raw)


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 <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

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;
}
----------------------------------------------------------------------




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-04-22  4:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-04-22  4:00 problems with pthread_{attr_}setprio on OSF 2.0? Alexandre Gonthier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox