Threadspecific data posix section 17, Functions implemented, Functions omitted – Comtrol eCos User Manual

Page 468: Notes, Thread cancellation posix section 18, Thread-specific data [posix section 17, Thread cancellation [posix section 18

Advertising
background image

Chapter 31. POSIX Standard Support

available, then the thread creator must supply a stack. If only a stack address is supplied then the stack is assumed
to be PTHREAD_STACK_MIN bytes long. This size is seldom useful for any but the most trivial of threads. If
a different sized stack is used, both the stack address and stack size must be supplied.

•

The

value

of

PTHREAD_THREADS_MAX

is

supplied

by

the

CYGNUM_POSIX_PTHREAD_THREADS_MAX

option.

This

defines

the

maximum

number of threads allowed. The POSIX standard requires this value to be at least 64, and this is the default
value set.

•

When the POSIX package is installed, the thread that calls main() is initialized as a POSIX thread. The priority

of that thread is controlled by the CYGNUM_POSIX_MAIN_DEFAULT_PRIORITY option.

Thread-Specific Data [POSIX Section 17]

Functions Implemented

int pthread_key_create(pthread_key_t

∗

key,

void (

∗

destructor)(void

∗

));

int pthread_setspecific(pthread_key_t key, const void

∗

pointer);

void

∗

pthread_getspecific(pthread_key_t key);

int pthread_key_delete(pthread_key_t key);

Functions Omitted

<none>

Notes

•

The

value

of

PTHREAD_DESTRUCTOR_ITERATIONS

is

provided

by

the

CYGNUM_POSIX_PTHREAD_DESTRUCTOR_ITERATIONS option. This controls the number of times
that a key destructor will be called while the data item remains non-NULL.

•

The value of PTHREAD_KEYS_MAX is provided by the CYGNUM_POSIX_PTHREAD_KEYS_MAX op-

tion. This defines the maximum number of per-thread data items supported. The POSIX standard calls for this
to be a minimum of 128, which is rather large for an embedded system. The default value for this option is set
to 128 for compatibility but it should be reduced to a more usable value.

Thread Cancellation [POSIX Section 18]

Functions Implemented

int pthread_cancel(pthread_t thread);

int pthread_setcancelstate(int state, int

∗

oldstate);

364

Advertising