[PATCH] Clean pthread functions namespace for C11 threads
Juan Manuel Torres Palma
j.m.torrespalma@gmail.com
Fri Jun 26 11:52:00 GMT 2015
Functions needed to implement threads.h functions that aren't covered
in that patch do already have a weak alias (e.g. __nanosleep) or are
defined as "versioned symbols" (e.g. __pthread_create or
__pthread_cond_*) what allows them to be redefined by the user
externally (I'm not really sure about this last topic as today has
been the first time I have read about it).
I made a list with the equivalent functions between POSIX functions
and threads.h functions, I don't know if these are actually enough,
but this is the list I originally made:
thrd_create <-> pthread_create
thrd_exit <-> pthread_exit
thrd_sleep <-> nanosleep
thrd_current <-> pthread_self
thrd_join <-> pthread_join
thrd_detach <-> pthread_detach
thrd_yield <-> sched_yield
mtx_init <-> pthread_mutex_init
mtx_destroy <-> pthread_mutex_destroy
mtx_lock <-> pthread_mutex_lock
mtx_unlock <-> pthread_mutex_unlock
mtx_trylock <-> pthread_mutex_trylock
mtx_timedlock <-> pthread_mutex_timedlock
cnd_init <-> pthread_cond_init
cnd_destroy <-> pthread_cond_destroy
cnd_wait <-> pthread_cond_wait
cnd_signal <-> pthread_cond_signal
cnd_broadcast <-> pthread_cond_broadcast
cnd_timedwait <-> pthread_cond_timedwait
tss_create <-> pthread_key_create
tss_delete <-> pthread_key_delete
tss_set <-> pthread_setspecific
tss_get <-> pthread_getspecific
It's true that during the implementation of mtx_init, I had to use
pthread_mutexattr_init and pthread_mutex_settype, that weren't
initially in my plans. Do you think more functions are affected apart
from these?
I have attached a fixed patch for lacking spaces in some weak_alias in
the previous version.
Cheers.
2015-06-25 23:52 GMT+02:00 Joseph Myers <joseph@codesourcery.com>:
> There are various places where this patch is missing a space before the
> '(' in calls to weak_alias.
>
> I expect there are lots of other POSIX functions called from pthreads (and
> so called indirectly from C11 threads functions) where you'll need to move
> to calling implementation-namespace versions (which may or may not already
> exist) - will those be addressed in a later patch in the series? (Adding
> threads.h to the headers tested for ISO11 in conform/, with corresponding
> expectations for header contents, will allow you to find such namespace
> issues through the linknamespace test results, but only once you actually
> have the C11 threads functions implemented.)
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
--
Juan Manuel Torres Palma.
Computer Science Student at Universidad de Granada.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clean-pthread-functions.patch
Type: text/x-patch
Size: 8439 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150626/cd2bb826/attachment.bin>
More information about the Libc-alpha
mailing list