Changeset cff773f in rtems for cpukit/libstdthreads
- Timestamp:
- Sep 10, 2015, 3:12:06 PM (4 years ago)
- Branches:
- master
- Children:
- 2f5e3c7
- Parents:
- e333089
- git-author:
- Sebastian Huber <sebastian.huber@…> (09/10/15 15:12:06)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (10/14/15 05:47:12)
- Location:
- cpukit/libstdthreads
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libstdthreads/call_once.c
re333089 rcff773f 27 27 */ 28 28 29 #include <sys/cdefs.h> 30 __FBSDID("$FreeBSD$"); 31 29 #include <threads.h> 32 30 #include <pthread.h> 33 34 #include "threads.h"35 31 36 32 void -
cpukit/libstdthreads/cnd.c
re333089 rcff773f 1 1 /*- 2 2 * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org> 3 * Copyright (c) 2015 embedded brains GmbH <info@embedded-brains.de> 3 4 * All rights reserved. 4 5 * … … 27 28 */ 28 29 29 #include <sys/cdefs.h> 30 __FBSDID("$FreeBSD$"); 31 30 #include <threads.h> 32 31 #include <errno.h> 33 #include <pthread.h>34 35 #include "threads.h"36 32 37 33 int … … 39 35 { 40 36 41 if (pthread_cond_broadcast(cond) != 0) 42 return (thrd_error); 37 _Condition_Broadcast(cond); 43 38 return (thrd_success); 44 39 } … … 48 43 { 49 44 50 (void)pthread_cond_destroy(cond);45 _Condition_Destroy(cond); 51 46 } 52 47 … … 55 50 { 56 51 57 switch (pthread_cond_init(cond, NULL)) { 58 case 0: 59 return (thrd_success); 60 case ENOMEM: 61 return (thrd_nomem); 62 default: 63 return (thrd_error); 64 } 52 _Condition_Initialize(cond); 53 return (thrd_success); 65 54 } 66 55 … … 69 58 { 70 59 71 if (pthread_cond_signal(cond) != 0) 72 return (thrd_error); 60 _Condition_Signal(cond); 73 61 return (thrd_success); 74 62 } … … 79 67 { 80 68 81 switch ( pthread_cond_timedwait(cond, mtx, ts)) {69 switch (_Condition_Wait_recursive_timed(cond, mtx, ts)) { 82 70 case 0: 83 71 return (thrd_success); … … 93 81 { 94 82 95 if (pthread_cond_wait(cond, mtx) != 0) 96 return (thrd_error); 83 _Condition_Wait_recursive(cond, mtx); 97 84 return (thrd_success); 98 85 } -
cpukit/libstdthreads/mtx.c
re333089 rcff773f 1 1 /*- 2 2 * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org> 3 * Copyright (c) 2015 embedded brains GmbH <info@embedded-brains.de> 3 4 * All rights reserved. 4 5 * … … 27 28 */ 28 29 29 #include <sys/cdefs.h> 30 __FBSDID("$FreeBSD$"); 31 30 #include <threads.h> 31 #include <sys/lock.h> 32 32 #include <errno.h> 33 #include <pthread.h>34 35 #include "threads.h"36 33 37 34 void … … 39 36 { 40 37 41 (void)pthread_mutex_destroy(mtx);38 _Mutex_recursive_Destroy(mtx); 42 39 } 43 40 … … 45 42 mtx_init(mtx_t *mtx, int type) 46 43 { 47 pthread_mutexattr_t attr;48 int mt;49 44 50 switch (type) { 51 case mtx_plain: 52 case mtx_timed: 53 mt = PTHREAD_MUTEX_NORMAL; 54 break; 55 case mtx_plain | mtx_recursive: 56 case mtx_timed | mtx_recursive: 57 mt = PTHREAD_MUTEX_RECURSIVE; 58 break; 59 default: 60 return (thrd_error); 61 } 62 63 if (pthread_mutexattr_init(&attr) != 0) 64 return (thrd_error); 65 if (pthread_mutexattr_settype(&attr, mt) != 0) 66 return (thrd_error); 67 if (pthread_mutex_init(mtx, &attr) != 0) 68 return (thrd_error); 45 (void)type; 46 _Mutex_recursive_Initialize(mtx); 69 47 return (thrd_success); 70 48 } … … 74 52 { 75 53 76 if (pthread_mutex_lock(mtx) != 0) 77 return (thrd_error); 54 _Mutex_recursive_Acquire(mtx); 78 55 return (thrd_success); 79 56 } … … 83 60 { 84 61 85 switch ( pthread_mutex_timedlock(mtx, ts)) {62 switch (_Mutex_recursive_Acquire_timed(mtx, ts)) { 86 63 case 0: 87 64 return (thrd_success); … … 97 74 { 98 75 99 switch ( pthread_mutex_trylock(mtx)) {76 switch (_Mutex_recursive_Try_acquire(mtx)) { 100 77 case 0: 101 78 return (thrd_success); 102 case EBUSY:79 default: 103 80 return (thrd_busy); 104 default:105 return (thrd_error);106 81 } 107 82 } … … 111 86 { 112 87 113 if (pthread_mutex_unlock(mtx) != 0) 114 return (thrd_error); 88 _Mutex_recursive_Release(mtx); 115 89 return (thrd_success); 116 90 } -
cpukit/libstdthreads/thrd.c
re333089 rcff773f 27 27 */ 28 28 29 #include <sys/cdefs.h> 30 __FBSDID("$FreeBSD$"); 31 29 #include <threads.h> 32 30 #include <pthread.h> 31 #include <sched.h> 33 32 #include <stdint.h> 34 33 #include <stdlib.h> 35 36 #include "threads.h"37 34 38 35 struct thrd_param { … … 125 122 { 126 123 127 pthread_yield();124 sched_yield(); 128 125 } -
cpukit/libstdthreads/tss.c
re333089 rcff773f 27 27 */ 28 28 29 #include <sys/cdefs.h> 30 __FBSDID("$FreeBSD$"); 31 29 #include <threads.h> 30 #include <limits.h> 32 31 #include <pthread.h> 33 34 #include "threads.h"35 32 36 33 int
Note: See TracChangeset
for help on using the changeset viewer.