07-05-2016
yeah, so i've discovered. been reading up on that today, had no idea it had such a large scope. thanks again for chiming in. this thread was surprisingly quiet. people here have been more vocal in the past typically.
10 More Discussions You Might Find Interesting
1. Programming
hello,
i have a problem with strlen. I have written this:
for(y=13,z=0; cInBuf!=' ';y++)
{
cBuf=cInBuf;
z++;
}
len = strlen(cBuf);
out=len/2;
fprintf(outfile,"F%i",out);
If strlen is e.g. 22, it write F22. I want to write F2F2.
How can i do this?... (5 Replies)
Discussion started by: ACeD
5 Replies
2. Shell Programming and Scripting
Hello,
Just a little problem with the ksh function : strlen
I want to use this function in this little ksh program :
while read line ; do
TOTO=$line
TOTONB=strlen($TOTO)
echo $TOTONB (3 Replies)
Discussion started by: steiner
3 Replies
3. Shell Programming and Scripting
Hi all,
I have a perl script which declares two variables and calls another perl script which accesses those variables. But I am unable to access the variables in the called script. My script is as follows:
my $ENV{a}="20";
system("perl called.pl");
and my called.pl contains:
print... (3 Replies)
Discussion started by: gurukottur
3 Replies
4. Programming
In a declaration, I have:
const char comment_begin = "<!--";
const char comment_end = "-->";
const int comment_begin_len = strlen(comment_begin);
const int comment_end_len = strlen(comment_end);
When I compile, I get the warnings:
emhttpc.c:64: warning: initializer element is not... (10 Replies)
Discussion started by: cleopard
10 Replies
5. Programming
I have been getting some flack recently for my use of strlen() and strnlen(). Honestly I have always just taken their functionality for granted as being the easiest way of getting the length of a string. Is it really so much better to do pointer arithmetic? What am I gaining besides more... (3 Replies)
Discussion started by: jjinno
3 Replies
6. Shell Programming and Scripting
Hi!
Some minutes ago I've posted a question related with sed regexps because I need to catch information sended with forms with GET action. This is the post: https://www.unix.com/shell-programming-scripting/127800-regular-expression-sed.html
But now I have a new question. Does cgi scripts have... (0 Replies)
Discussion started by: GagleKas
0 Replies
7. Programming
My OS (Debian) and gcc use the UTF-8 locale. This code says that the char size is 1 byte but the size of 'a' is really 4 bytes.
int main(void)
{
setlocale(LC_ALL, "en_US.UTF-8");
printf("Char size: %i\nSize of char 'a': %i\nSize of Euro sign '€': %i\nLength of Euro sign: %i\n",... (8 Replies)
Discussion started by: cyler
8 Replies
8. AIX
Hello All,
I am getting this error while compiling my application on IBM AIX 5.3.
As I tried to define _XOPEN_SOURCE=500 in makefile, that didn't work.
Please help us to resolve the error. (0 Replies)
Discussion started by: mustus
0 Replies
9. Shell Programming and Scripting
Hi! I've a C program as shown below..
The line numbers and the statements of the program are separated by a space..
1 #include<stdio.h>
2 char a,b,c;
3 float x,y,z;
4 int main()
5 {
6 int d,e,f;
7 // further declarations
8 // further declarations
9 /* body*/
10 }
11 void fun1()
12... (1 Reply)
Discussion started by: abk07
1 Replies
10. Programming
Hello,
This function was copied into my code, which was compiled without error/warning, but when executed there is always Segmentation fault at the end after the output (which seems correct!):
void get_hashes(unsigned int hash, unsigned char *in)
{
unsigned char *str = in;
int pos =... (7 Replies)
Discussion started by: yifangt
7 Replies
LEARN ABOUT DEBIAN
pthread_attr_getscope
PTHREAD_ATTR_SETSCOPE(3) Linux Programmer's Manual PTHREAD_ATTR_SETSCOPE(3)
NAME
pthread_attr_setscope, pthread_attr_getscope - set/get contention scope attribute in thread attributes object
SYNOPSIS
#include <pthread.h>
int pthread_attr_setscope(pthread_attr_t *attr, int scope);
int pthread_attr_getscope(pthread_attr_t *attr, int *scope);
Compile and link with -pthread.
DESCRIPTION
The pthread_attr_setscope() function sets the contention scope attribute of the thread attributes object referred to by attr to the value
specified in scope. The contention scope attribute defines the set of threads against which a thread competes for resources such as the
CPU. POSIX.1-2001 specifies two possible values for scope:
PTHREAD_SCOPE_SYSTEM
The thread competes for resources with all other threads in all processes on the system that are in the same scheduling allocation
domain (a group of one or more processors). PTHREAD_SCOPE_SYSTEM threads are scheduled relative to one another according to their
scheduling policy and priority.
PTHREAD_SCOPE_PROCESS
The thread competes for resources with all other threads in the same process that were also created with the PTHREAD_SCOPE_PROCESS
contention scope. PTHREAD_SCOPE_PROCESS threads are scheduled relative to other threads in the process according to their schedul-
ing policy and priority. POSIX.1-2001 leaves it unspecified how these threads contend with other threads in other process on the
system or with other threads in the same process that were created with the PTHREAD_SCOPE_SYSTEM contention scope.
POSIX.1-2001 only requires that an implementation support one of these contention scopes, but permits both to be supported. Linux supports
PTHREAD_SCOPE_SYSTEM, but not PTHREAD_SCOPE_PROCESS.
The pthread_attr_getscope() function returns the contention scope attribute of the thread attributes object referred to by attr in the buf-
fer pointed to by scope.
RETURN VALUE
On success, these functions return 0; on error, they return a nonzero error number.
ERRORS
pthread_attr_setscope() can fail with the following errors:
EINVAL An invalid value was specified in scope.
ENOTSUP
scope specified the value PTHREAD_SCOPE_PROCESS, which is not supported on Linux.
CONFORMING TO
POSIX.1-2001.
NOTES
The PTHREAD_SCOPE_SYSTEM contention scope typically indicates that a user-space thread is bound directly to a single kernel-scheduling
entity. This is the case on Linux for the obsolete LinuxThreads implementation and the modern NPTL implementation, which are both 1:1
threading implementations.
POSIX.1-2001 specifies that the default contention scope is implementation-defined.
SEE ALSO
pthread_attr_init(3), pthread_attr_setaffinity_np(3), pthread_attr_setinheritsched(3), pthread_attr_setschedparam(3),
pthread_attr_setschedpolicy(3), pthread_create(3), pthreads(7)
COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2008-10-24 PTHREAD_ATTR_SETSCOPE(3)