diff options
| author | yangjie11 <[email protected]> | 2020-11-18 09:56:35 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-11-18 09:56:35 +0800 |
| commit | d4a682e8d97fa131e5a8d795f8c5451d55cdd5b0 (patch) | |
| tree | 4773b40cb012475c5daf74bfd55707e141477669 /components/libc/pthreads/pthread.h | |
| parent | 2b98f4720c827ae1850df78299f6b273d568c8c7 (diff) | |
| parent | 2ef3c9d861f55253620996a94831a4be31ca6620 (diff) | |
Merge pull request #3 from RT-Thread/master
sync
Diffstat (limited to 'components/libc/pthreads/pthread.h')
| -rw-r--r-- | components/libc/pthreads/pthread.h | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/components/libc/pthreads/pthread.h b/components/libc/pthreads/pthread.h index 6a82375de4..7bb72b726c 100644 --- a/components/libc/pthreads/pthread.h +++ b/components/libc/pthreads/pthread.h @@ -12,6 +12,11 @@ #define __PTHREAD_H__ #include <rtthread.h> + +#ifdef __cplusplus +extern "C" { +#endif + #include <posix_types.h> #include <sched.h> @@ -27,7 +32,7 @@ #define PTHREAD_EXPLICIT_SCHED 0 #define PTHREAD_INHERIT_SCHED 1 -typedef rt_thread_t pthread_t; +typedef long pthread_t; typedef long pthread_condattr_t; typedef long pthread_rwlockattr_t; typedef long pthread_mutexattr_t; @@ -71,15 +76,21 @@ enum #define PTHREAD_SCOPE_PROCESS 0 #define PTHREAD_SCOPE_SYSTEM 1 +struct sched_param +{ + int sched_priority; +}; + struct pthread_attr { - void* stack_base; - rt_uint32_t stack_size; /* stack size of thread */ + void* stackaddr; /* stack address of thread */ + int stacksize; /* stack size of thread */ - rt_uint8_t priority; /* priority of thread */ - rt_uint8_t detachstate; /* detach state */ - rt_uint8_t policy; /* scheduler policy */ - rt_uint8_t inheritsched; /* Inherit parent prio/policy */ + int inheritsched; /* Inherit parent prio/policy */ + int schedpolicy; /* scheduler policy */ + struct sched_param schedparam; /* sched parameter */ + + int detachstate; /* detach state */ }; typedef struct pthread_attr pthread_attr_t; @@ -126,11 +137,6 @@ struct pthread_barrier }; typedef struct pthread_barrier pthread_barrier_t; -struct sched_param -{ - int sched_priority; -}; - /* pthread thread interface */ int pthread_attr_destroy(pthread_attr_t *attr); int pthread_attr_init(pthread_attr_t *attr); @@ -166,10 +172,7 @@ rt_inline int pthread_equal (pthread_t t1, pthread_t t2) return t1 == t2; } -rt_inline pthread_t pthread_self (void) -{ - return rt_thread_self(); -} +pthread_t pthread_self (void); void pthread_exit (void *value_ptr); int pthread_once(pthread_once_t * once_control, void (*init_routine) (void)); @@ -262,4 +265,8 @@ int pthread_barrier_init(pthread_barrier_t *barrier, int pthread_barrier_wait(pthread_barrier_t *barrier); +#ifdef __cplusplus +} +#endif + #endif |
