tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pthreads and C11/C17 threads



On 17.04.2019 18:52, Robert Elz wrote:
> I have seen this question:
> 
> 	does anyone know of an implementation that has pthreads and
> 	C11/C17 threads, with pthread_t and thrd_t defined as different types?
> 
> As best I can tell in NetBSD we do not have a thrd_t at all (but I
> might be missing something).   If we do, or someday we might, is it
> likely to be acceptable for those 2 types to be the same.
> 
> That is, unless someone has an objection, this is what POSIX might
> require (it has some implication I do not really understand, as
> threads are not my thing, about what functions can be called with
> what states, like if a library wants to discover what the current
> thread is, when it was created outside the library ... or something).
> 
> kre
> 

I have got a local patch implementing C11 for NetBSD.

I need to refresh it a bit as the right approach is to embed it into
libc and make it work once upon a program is linked with -lpthread. My
integration was still incomplete as my work was interrupted by
libpthrad(3) bugs (now solved).

A direct user from base for C11 threads is (at least used to be) MESA.

I use the following types:

+/* ISO/IEC 9899:201x 7.26.1/4 */
+typedef pthread_cond_t	  cnd_t;
+typedef pthread_t	  thrd_t;
+typedef int		  tss_t;
+typedef pthread_mutex_t	  mtx_t;
+typedef void		(*tss_dtor_t)	(void *);
+typedef int		(*thrd_start_t)	(void *);
+typedef	pthread_once_t	  once_flag;

It would be nice to get it for -9.

Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index