Re: Cygwin C11 threads Implementation

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Apr 17 17:16, Joel Sherrill wrote:
> Hi
> 
> In looking at the C11 threads.h header to see how Cygwin defined thrd_t in
> comparison to RTEMS, I noticed that at least in the version of Cygwin I
> have installed, machine/threads.h
> is missing and there is no typedef for thrd_t in /usr/include.
> 
> RTEMS uses the FreeBSD implementation of these services and I would think
> Cygwin
> could also.
> 
> Is this functionality missing or am I missing something?

I'm not exactly familiar with this C11 stuff, but, yes, seems like this
functionality is missing.

I'm not sure if we can use the FreeBSD implementation, given how our
pthreads implementation differs, e.g., all pthread related types are
pointers to an opaque struct, but it's certainly worth a try.  At a
first glance, our machine/_threads.h would have to look like this:

--- SNIP ---
/* pthread_cond_t */
typedef void *cnd_t;

/* pthread_mutex_t */
typedef void *mtx_t;

/* pthread_t */
typedef void *thrd_t;

/* pthread_key_t */
typedef void *tss_t;

/* pthread_once_t */
typedef struct
{
  mtx_t mutex;
  int _flag;
} once_flag;

/* PTHREAD_ONCE_INIT */
#define ONCE_FLAG_INIT { 0 }

/* PTHREAD_DESTRUCTOR_ITERATIONS */
#define TSS_DTOR_ITERATIONS 1
--- SNAP ---

I guess the cnd_t/mtx_t definitions would make some problems
with the FreeBSD implementation?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAly4NVYACgkQ9TYGna5E
T6DK+BAAoeXcadjCbjQcpWU23vliNUf+47tkRyKssyFPXuNkgfDB5pMwevE978KD
GnN1oiMVGpKc6tpbSxc2uGWBvec/ucJPCXOkeHoerVsKN5V348AL2WrRubL0D7KP
7wRB2Itb2vLDZqxcYbVtPyxwSEKXIRckhHGRPhmaibVhgQmnI6+cSTPrbWmvOmjw
Mk/uRmkN1ZxqO7EBYUF9ZFJ+XLECulNj2HgR8/IdjqMJQYSOP57LuQ6HUT2GdUYT
BK1R31eswiEswq/R6Fy/vzt7YEgX+uQcLnCA52Lp1+DdFc7rO0p9GflE0ZZ4fgw9
77AwJcVQtZF/KGhNKqqsWlBcUeAiMaEFnamoqQ7Q6SrPMi36v7ymtdPpjCwDJJ9i
/f6YTe1j3yxA3rJOx8UKS25fFIAkv7oRjK2PpfWjW3Lxmla9o4eagj4rJ2KWyoFd
5ZGG8wi6Eqa++mPQgM8q9RJvdq7LB2553PP6m31sDI7K+U8aXf450kmUI7bjGe1s
fCK2onRFToPF64iicDPaYBuX4XwB+SchKDV5TinvvHV8kBgWzQ7NNEt/mPVJEdPh
HfFonjT8+IwXSdIAOb8+L3LAITWOt6jiIUYy6vmCYatU/4zNk7tsO1MaqS2sM7Kj
EWbsfR9pXQPFOam2nqKAHP0s+pQeRs7yE6o9FAjb047xSkC+hHs=
=iIP2
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.