[Patch] C1X threading support
Kostik Belousov
kostikbel at gmail.com
Fri Dec 16 22:42:46 UTC 2011
On Fri, Dec 16, 2011 at 10:49:13PM +0100, Ed Schouten wrote:
> Hi folks,
>
> We can expect C11 (or C12) to be released in the nearby future. I
> already took the liberty of adding fallbacks for some of the language
> keywords to <sys/cdefs.h>, but it seems the standard also includes a new
> threading API.
>
> In my opinion the ISO folks suffer a bit from the Not Invented Here
> syndrome. In an earlier revision of the C1X specification, they even
> described a `struct xtime', which had a purpose identical to `struct
> timespec'. The same holds for the threading API. It can be 1:1 mapped to
> a subset of pthread -- why not simply standardize that subset then?
>
> Putting my personal objections aside, I do think we should add support
> for the API by the time C1X is final. Attached is a patch that adds the
> new API to libthr. It simply wraps all the calls around pthread. Even
> the objects used by the API are type compatible with the ones used by
> pthread.
>
> The questions:
>
> - As this API is just a second-class citizen and will not be used by the
> C library, I suspect there is no need for underscore prefixing and
> weak aliasing. Is this correct?
If application that does not use the new interface supposed to be
able to implement function with new names, then the not-underscored
symbols must be weak.
>
> - When accompanied with man pages, are there any objections if I commit
> this to SVN when C1X is official?
+int
+cnd_init(cnd_t *cond)
+{
+
+ if (_pthread_cond_init(cond, NULL) != 0)
+ return (errno == ENOMEM ? thrd_nomem : thrd_error);
+ return (thrd_success);
+}
pthread_cond_init does not set errno, it returns error.
There are several more instances of such errno use in the patch.
Do you have reference to the draft ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-threads/attachments/20111216/501c6009/attachment-0001.pgp
More information about the freebsd-threads
mailing list