Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../.././../../../usr/man/man3c/pthread_getattr_np.3c
Real path: /usr/share/man/man3c/pthread_getattr_np.3c
Zurück
'\" te .\" Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. .TH pthread_getattr_np 3C "08 Aug 2017" "Oracle Solaris 11.4" "Standard C Library Functions" .SH NAME pthread_getattr_np \- get attributes of thread .SH SYNOPSIS .LP .nf #include <pthread.h> int pthread_getattr_np(pthread_t t, pthread_attr_t *attr); .fi .SH DESCRIPTION .sp .LP The \fBpthread_getattr_np()\fR function allocates and initializes a thread attribute object with values representing an existing thread. The values of the fields in the \fBpthread_attr_t\fR structure are usually the same as those provided during the creation of thread by using the \fBpthread_create()\fR function or the \fBthr_create()\fR function. However, the following factors occur: .RS +4 .TP .ie t \(bu .el o Stack address is often different due to memory alignment or other platform requirements .RE .RS +4 .TP .ie t \(bu .el o The schedule inheritance will always match the default value .RE .RS +4 .TP .ie t \(bu .el o The \fBdetach\fR or \fBdaemon\fR states of a thread may have changed after the thread gets created .RE .sp .LP Some of these values are subject to change. The \fBpthread_getattr_np()\fR function returns a snapshot of the current state. The thread attributes object returned as \fBattr\fR, is intended for use with the various \fBpthread_attr_get*()\fR functions to extract individual pieces of information such as the stack address. For example, the \fBpthread_attr_getstackaddr()\fR function. The caller is responsible for freeing the memory allocated for \fBattr\fR by calling the \fBpthread_attr_destroy()\fR function. .SH RETURN VALUES .sp .LP If successful, the \fBpthread_getattr_np()\fR function returns \fB0\fR. Otherwise, an error number is returned to indicate the error. It is not an error for the target thread to be a zombie thread. .SH ERRORS .sp .LP The \fBpthread_getattr_np()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEFAULT\fR\fR .ad .RS 10n .rt One or more attributes of thread could not be determined .RE .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt \fBattr\fR is \fBNULL\fR .RE .sp .ne 2 .mk .na \fB\fBESRCH\fR\fR .ad .RS 10n .rt The value specified by a thread does not refer to an existing thread .RE .SH EXAMPLES .LP \fBExample 1\fR Retrieve a Thread's Stack Address and Size .sp .LP The following is an example that shows how to retrieve a thread's current stack address and size. .sp .in +2 .nf /* cc thisfile.c */ # include <pthread.h> # include <stdio.h> int main(int argc, char *argv[]) { pthread_attr_t attr; size_t stksize; void *stkaddr; (void) pthread_getattr_np(pthread_self(), &attr); (void) pthread_attr_getstack(&attr, &stkaddr, &stksize); (void) pthread_attr_destroy(&attr); printf("Stack Address = %p\en", stkaddr); printf("Stack Size = %zu\en", stksize); return (0); } .fi .in -2 .sp .SH ATTRIBUTES .sp .LP See \fBattributes\fR(7) for descriptions of the following attributes: .sp .TS tab( ) box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Committed _ MT-Level MT-Safe .TE .sp .SH SEE ALSO .sp .LP \fBpthread_attr_init\fR(3C), \fBpthread_attr_destroy\fR(3C), \fBthreads\fR(7), \fBattributes\fR(7), \fBstandards\fR(7)