This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
RE: pthread_condattr_setclock() and CLOCK_BOOTTIME
- From: Hannu Mallat <hannu dot mallat at jolla dot com>
- To: Carlos O'Donell <carlos at redhat dot com>, "libc-help at sourceware dot org" <libc-help at sourceware dot org>
- Date: Fri, 5 Sep 2014 06:53:11 +0000
- Subject: RE: pthread_condattr_setclock() and CLOCK_BOOTTIME
- Authentication-results: sourceware.org; auth=none
- References: <C916EDABDC17FC45A9CF64E949622B45131FB7 at ord2mbx12c dot mex05 dot mlsrvr dot com>,<54087162 dot 8050801 at redhat dot com>
Hi Carlos, thanks for your reply,
> Technically though you must be *very* careful not to break ABI, and
> since I haven't seen your patch I don't know where you get the extra
> 3 bits from. The structure itself must never change size. If you happen
> to have padding then you can use that, but I haven't verified this.
I admit I haven't fully checked all the implications yet.
I'm incrementing COND_NWAITERS_SHIFT from 1 to 3 so that three bits
of clock ID can be stored in the low bits of struct pthread_condattr_value
field.
This does have the effect of limiting the maximum number of waiters
on a mutex since the same macro is used in pthread_cond_wait(), among
other places, but I would guess that even with 32-bit ints there are still
enough bits left for practical purposes.
Comment in nptl/sysdeps/unix/sysv/linux/internaltypes.h seems to indicate
up to 7 bits can be used for clock ID, but I don't know whether that is
up to date or not.
/* Conditional variable attribute data structure. */
struct pthread_condattr
{
/* Combination of values:
Bit 0 : flag whether coditional variable will be shareable between
processes.
Bit 1-7: clock ID. */
int value;
};
> Please post to libc-alpha.
Ok, I'll first check if there are any differences between the 2.15 code
I've been working on and the newer version, and will post a draft patch
there then.
BR,
H.