Named fields in Structure Initialization
Joel Sherrill
joel.sherrill at OARcorp.com
Fri Aug 10 19:26:51 UTC 2012
Hi
I was looking at the definition of the default pthread_attr_t
in cpukit/posix/src/pthread.c. What's the consensus on
explicitly naming fields as opposed to using order to resolve
things.
In the filesystem code, I think it is all named now. I was thinking
of changing this over to something like this:
const pthread_attr_t _POSIX_Threads_Default_attributes = {
.is_initialized = true, /* is_initialized */
.stackaddr = NULL, /* stackaddr */
.stacksize = 0, /* stacksize -- will be
adjusted to minimum */
.contentionscope = PTHREAD_SCOPE_PROCESS, /* contentionscope */
.inheritsched = PTHREAD_INHERIT_SCHED, /* inheritsched */
.schedpolicy = SCHED_FIFO, /* schedpolicy */
.schedparam = { /* schedparam */
.sched_priority = 2, /* sched_priority */
#if defined(_POSIX_SPORADIC_SERVER) || \
defined(_POSIX_THREAD_SPORADIC_SERVER)
.sched_ss_low_priority = 0, /* sched_ss_low_priority */
.sched_ss_repl_period = { 0L, 0 }, /* sched_ss_repl_period */
.sched_ss_init_budget = { 0L, 0 } /* sched_ss_init_budget */
#endif
},
#if defined(_POSIX_THREAD_CPUTIME)
.cputime_clock_allowed = 1, /* cputime_clock_allowed */
#endif
.detachstate = PTHREAD_CREATE_JOINABLE, /* detachstate */
};
--
Joel Sherrill, Ph.D. Director of Research& Development
joel.sherrill at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the devel
mailing list