strange problems with pthreads
From: Chris Friesen (cfriesen_at_ca.nortel.com)
Date: 02/20/04
- Next message: Billy O'Connor: "Re: strange problems with pthreads"
- Previous message: Hannah Schroeter: "Re: Single stepping w/o gdb"
- Next in thread: Billy O'Connor: "Re: strange problems with pthreads"
- Reply: Billy O'Connor: "Re: strange problems with pthreads"
- Reply: Ulrich Eckhardt: "Re: strange problems with pthreads"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 20 Feb 2004 12:36:57 -0500
I'm running the following code as root, on a uniprocessor system. I get
an error printed out:
error:No such process priority:40 policy:2
Any idea what's going on? Am I doing something invalid?
Chris
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
pthread_t t1;
void *func(void *p)
{
pid_t pid;
int status;
struct sched_param schedParam;
int policy = SCHED_RR;
int priority = 40;
schedParam.sched_priority = priority;
int schedRc = pthread_setschedparam(t1, policy, &schedParam);
if (schedRc != 0)
{
fprintf(stderr, "error:%s priority:%d policy:%d\n",
strerror(schedRc), priority, policy);
}
pthread_exit(EXIT_SUCCESS);
return 0;
}
int main(int argc, char **argv)
{
pthread_create(&t1, 0, func,(void*)1);
pthread_join(t1,0);
return 0;
}
-- Chris Friesen | MailStop: 043/33/F10 Nortel Networks | work: (613) 765-0557 3500 Carling Avenue | fax: (613) 765-2986 Nepean, ON K2H 8E9 Canada | email: cfriesen@nortelnetworks.com
- Next message: Billy O'Connor: "Re: strange problems with pthreads"
- Previous message: Hannah Schroeter: "Re: Single stepping w/o gdb"
- Next in thread: Billy O'Connor: "Re: strange problems with pthreads"
- Reply: Billy O'Connor: "Re: strange problems with pthreads"
- Reply: Ulrich Eckhardt: "Re: strange problems with pthreads"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|