Question on Pthreads


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Question on Pthreads
# 1  
Old 10-31-2006
Question on Pthreads

How to give superuser privileges while setting the attributes like pthread_attr_setschedpolicy( )??
Even with normal user mode ,it is working fine for me.But in man pages, they have specied that to set the scheduling policy as SCHED_FIFO, the process should have superuser privileges.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Idleness with pthreads

Hello, I am writing a threaded program using the pthread library in linux. I have a master thread that needs to control worker threads, in particular, it has to be able to ensure that none of the worker threads will be running for a specified amount of time, even if the worker threads are... (7 Replies)
Discussion started by: andres625
7 Replies

2. Programming

MultiThreading using Pthreads

Situation: i have multiple pthread_create calls like this: pthread_create(...., ThreadFunc1,.....); pthread_create(...., ThreadFunc2,.....); . . which i am using to create multiple threads.All the "ThreadFunc<i>" functions are actually calling same function "Receive" of a class using same... (3 Replies)
Discussion started by: Sastra
3 Replies

3. Programming

Memory LEAK with pthreads

I have this code... #include <stdio.h> #include <iostream> #include <pthread.h> static void* cliente(void *datos); int main() { pthread_attr_t tattr; int ret; size_t size = PTHREAD_STACK_MIN + 0x0100; ret = pthread_attr_init(&tattr); ret =... (8 Replies)
Discussion started by: JEscola
8 Replies

4. Programming

Problem with pthreads

hi i have a code: I found that after exiting from child thread memory isn't freed. I commented everything which is "some actions" here, so thread's function contains only two lines. But it doesn't help. What do I do wrong? Thanks a lot (3 Replies)
Discussion started by: sery0ga
3 Replies

5. HP-UX

pthreads

Hi! I'm linking my hpux code using -lpthread (gcc), yet it references libpthread_tr.1, the debug version of the pthread lib. How do I force it to use pthreads? Thanks, :) (3 Replies)
Discussion started by: zackz
3 Replies

6. Programming

Behavior of pthreads

Hi All, I ve written a small program to get started off with pthreads. I somehow feel the program doesnt meet the purpose. Please find the code and the output below. Please find my question at the bottom. #include <pthread.h> #include <stdio.h> #include <stdlib.h> void *PrintThread1(void... (4 Replies)
Discussion started by: nhrraj
4 Replies

7. Programming

PThreads

I have created a thread program, it is attached. My problem is that I need to loop this program multiple times, and basically reset everything including the threads created previously. I try to loop the program, the first run is fine, as always, but the second run of the program, the initialize... (0 Replies)
Discussion started by: justgotthis
0 Replies

8. Programming

pthreads

howcome that pthtreads spawn 2 extra processes? I'm kind of new with pthreads but fork() did not act like this. Anyone who can give me a technical explanation of what happends with mother / daughter processes? Best regards Esaia. (2 Replies)
Discussion started by: Esaia
2 Replies

9. Programming

pthreads

Does any one no of some good web site which will explain about how to program using pthreads in a UNIX enviroment? (6 Replies)
Discussion started by: fishman2001
6 Replies

10. UNIX for Advanced & Expert Users

PThreads

Can anyone explain me how to use pthread_key_create() , pthread_setspecific(), pthread_getspecific() and pthread_key_delete () routines in pthreads. Kindly state by an example. (3 Replies)
Discussion started by: S.P.Prasad
3 Replies
Login or Register to Ask a Question
PTHREAD_ATTR_SETSCHEDPOLICY(3)				     Linux Programmer's Manual				    PTHREAD_ATTR_SETSCHEDPOLICY(3)

NAME
pthread_attr_setschedpolicy, pthread_attr_getschedpolicy - set/get scheduling policy attribute in thread attributes object SYNOPSIS
#include <pthread.h> int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy); int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy); Compile and link with -pthread. DESCRIPTION
The pthread_attr_setschedpolicy() function sets the scheduling policy attribute of the thread attributes object referred to by attr to the value specified in policy. This attribute determines the scheduling policy of a thread created using the thread attributes object attr. The supported values for policy are SCHED_FIFO, SCHED_RR, and SCHED_OTHER, with the semantics described in sched(7). The pthread_attr_getschedpolicy() returns the scheduling policy attribute of the thread attributes object attr in the buffer pointed to by policy. In order for the policy setting made by pthread_attr_setschedpolicy() to have effect when calling pthread_create(3), the caller must use pthread_attr_setinheritsched(3) to set the inherit-scheduler attribute of the attributes object attr to PTHREAD_EXPLICIT_SCHED. RETURN VALUE
On success, these functions return 0; on error, they return a nonzero error number. ERRORS
pthread_attr_setschedpolicy() can fail with the following error: EINVAL Invalid value in policy. POSIX.1 also documents an optional ENOTSUP error ("attempt was made to set the attribute to an unsupported value") for pthread_attr_setschedpolicy(). ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +-------------------------------+---------------+---------+ |Interface | Attribute | Value | +-------------------------------+---------------+---------+ |pthread_attr_setschedpolicy(), | Thread safety | MT-Safe | |pthread_attr_getschedpolicy() | | | +-------------------------------+---------------+---------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008. EXAMPLE
See pthread_setschedparam(3). SEE ALSO
pthread_attr_init(3), pthread_attr_setinheritsched(3), pthread_attr_setschedparam(3), pthread_create(3), pthread_setschedparam(3), pthread_setschedprio(3), pthreads(7), sched(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2017-09-15 PTHREAD_ATTR_SETSCHEDPOLICY(3)