Self-contained POSIX synchronization objects for RTEMS 4.12?

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Sep 19 13:16:44 UTC 2017


Hello,

we have to make some trade-offs in the implementation with respect to 
the error checking. The operations get a pointer to the synchronization 
object, e.g.

int sem_post(sem_t *sem);

int pthread_mutex_lock(pthread_mutex_t *mutex);

Do we want to check for NULL pointers?

Do we want to check for other obviously invalid pointer values, e.g. 
SEM_FAILED?

Do we want to check if the object has been initialized?

glibc uses no checks at all.

FreeBSD checks that the object has been initialized. For this purpose it 
embeds a magic value field in the object structure. The drawback is that 
if we also do this, the objects are not zero-initialized and thus cannot 
reside in the BSS section.

Destruction of synchronization objects in use is undefined behaviour 
according to POSIX. Do we want to flush waiting threads during 
destruction? This is a complex operation.

What you think?

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list