This is the mail archive of the libc-alpha@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: threads.h implementation issues


On Wed, Oct 29, 2014 at 08:23:57AM +0100, Juan Manuel Torres Palma wrote:
> > 3. Cast int->uintptr_t->void*->uintptr_t->int to round-trip the int
> >    result via a value of type void*. This assumes that any value of
> >    int can be represented in uintptr_t, and that any value of
> >    uintptr_t can be represented in void*. I think this is acceptable
> >    but others may disagree.
> 
> That worked amazingly good, thanks.
> 
> > That should be fine, but you need to keep nanosleep out of the
> > namespace, so either use __nanosleep (if it exists) or an inline
> > syscall.
> 
> I thought that nanosleep is part of <time.h> that is automatically
> included with threads.h, so there must be no namespace problems. If
> there is, please let me know why.

nanosleep is part of POSIX that's exposed by POSIX's version of
time.h. It's not part of ISO C and not in any namespace reserved by
ISO C.

> One more question. I made a function named __thrd_err_map, that I use
> to match errors between those received by pthread_* functions and is
> only used in the definition file (.c), so I'm also including
> <errno.h>. Any inconvenience on that?

Including it from where? It can't be included from threads.h. But it
shouldn't need to be. Mapping of errors needs to take place internally
in the library, not as part of the calling application.

Rich


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