Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c,comp.programming.threads Subject: Re: Trivial C11 threads.h wrapper (public domain) Date: Sun, 30 Sep 2012 14:28:45 -0700 Organization: None to speak of Lines: 36 Message-ID: References: <5065EAFD.1050102@loria.fr> <5068B604.9020606@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx04.eternal-september.org; posting-host="5842a546a2d4559ed11e9ac4721da702"; logging-data="17613"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+d4qJNsTvjkMR18BZfmjqb" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:rOquuiBVgdjRGL8peq6YjBSfIVY= sha1:UsREBVRCh5QBYq+I5nj1rHR4iT0= Xref: csiph.com comp.lang.c:26915 comp.programming.threads:1129 Markus Elfring writes: >> There is already an implementation of C11 threads as a wrapper around >> POSIX threads that is publicly available. > > I would interpret source code like the following as an update candidate. I'm not sure what you mean by "update candidate". > http://p99.gforge.inria.fr/p99-html/p99__threads_8h_source.html : > ... > 00633 // 7.26.4 Mutex functions > 00634 > 00638 p99_inline > 00639 void mtx_destroy(mtx_t *p00_mtx) { > 00640 (void)pthread_mutex_destroy(&P99_ENCP(p00_mtx)); > 00641 } > ... > > > How do think about to get rid of the cast to the return type "void" in > such use cases? It doesn't matter much. The POSIX pthread_mutex_destroy() function returns an int result; the C11 mtx_destroy() function returns void. The (void) cast in this particular implementation is probably there to silence a compiler warning about the result of the call being discarded. The semantics are exactly the same with or without the cast. Could you be reading more into this than is actually there? -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"