]> xenbits.xensource.com Git - unikraft/libs/pthread-embedded.git/commit
pthread.h: Convert pthread_t to unsigned long
authorCostin Lupu <costin.lupu@cs.pub.ro>
Sun, 13 Oct 2019 13:16:55 +0000 (16:16 +0300)
committerFelipe Huici <felipe.huici@neclab.eu>
Mon, 14 Oct 2019 12:20:36 +0000 (14:20 +0200)
commit5d25c1d197ed8a165097cd53605612f81138328c
tree7d4d5bf9de301b57f5f78cbdc95e4e7d29ddf489
parentfc2b63e1b1cb1fed9ba97047acb951ad92288d1d
pthread.h: Convert pthread_t to unsigned long

The POSIX standard outlines that pthread_t is an opaque data type and no
assumption should be made about it. However, we observed that libraries and
applications assume frequently that pthread_t is a pointer or other numerical
data type and use it to identify the corresponding threads.

pthread-embedded makes the strange decision to define pthread_t as
structure, a decision that, although compliant with POSIX standards,
makes the porting process a bit challenging. Therefore we introduce a
conversion function which simply returns the first encapsulated
unsigned long value in the structure which actually points to the
underlying thread object.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
include/pthread.h