This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: pthread_condattr_setclock() and CLOCK_BOOTTIME


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]