Deleted Added
full compact
thrd.c (228904) thrd.c (279318)
1/*-
2 * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/lib/libstdthreads/thrd.c 228904 2011-12-26 21:51:53Z ed $
26 * $FreeBSD: head/lib/libstdthreads/thrd.c 279318 2015-02-26 09:42:03Z kib $
27 */
28
29#include <sys/cdefs.h>
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/lib/libstdthreads/thrd.c 228904 2011-12-26 21:51:53Z ed $");
30__FBSDID("$FreeBSD: head/lib/libstdthreads/thrd.c 279318 2015-02-26 09:42:03Z kib $");
31
32#include <pthread.h>
33#include <stdint.h>
34#include <stdlib.h>
35
36#include "threads.h"
37
38struct thrd_param {

--- 64 unchanged lines hidden (view full) ---

103
104int
105thrd_join(thrd_t thr, int *res)
106{
107 void *value_ptr;
108
109 if (pthread_join(thr, &value_ptr) != 0)
110 return (thrd_error);
31
32#include <pthread.h>
33#include <stdint.h>
34#include <stdlib.h>
35
36#include "threads.h"
37
38struct thrd_param {

--- 64 unchanged lines hidden (view full) ---

103
104int
105thrd_join(thrd_t thr, int *res)
106{
107 void *value_ptr;
108
109 if (pthread_join(thr, &value_ptr) != 0)
110 return (thrd_error);
111 *res = (intptr_t)value_ptr;
111 if (res != NULL)
112 *res = (intptr_t)value_ptr;
112 return (thrd_success);
113}
114
115int
116thrd_sleep(const struct timespec *duration, struct timespec *remaining)
117{
118
119 return (nanosleep(duration, remaining));
120}
121
122void
123thrd_yield(void)
124{
125
126 pthread_yield();
127}
113 return (thrd_success);
114}
115
116int
117thrd_sleep(const struct timespec *duration, struct timespec *remaining)
118{
119
120 return (nanosleep(duration, remaining));
121}
122
123void
124thrd_yield(void)
125{
126
127 pthread_yield();
128}