export more symbols of PThread.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2433 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2012-11-23 02:40:32 +00:00
parent ffbd0a1673
commit 44eaae8c80
13 changed files with 123 additions and 5 deletions

View File

@ -9,13 +9,19 @@
*
* Change Logs:
* Date Author Notes
* 2012-11-23 Bernard Add extern "C"
*/
#ifndef __SPI_H__
#define __SPI_H__
#include <stdlib.h>
#include <rtthread.h>
#ifdef __cplusplus
extern "C"{
#endif
#define RT_SPI_CPHA (1<<0) /* bit[0]:CPHA, clock phase */
#define RT_SPI_CPOL (1<<1) /* bit[1]:CPOL, clock polarity */
/**
@ -247,4 +253,8 @@ rt_inline void rt_spi_message_append(struct rt_spi_message *list,
message->next = RT_NULL;
}
#ifdef __cplusplus
}
#endif
#endif

View File

@ -12,6 +12,7 @@
* 2006-03-13 bernard first version
* 2012-05-15 lgnq modified according bernard's implementation.
* 2012-05-28 bernard code cleanup
* 2012-11-23 bernard fix compiler warning.
*/
#include <rthw.h>
@ -427,7 +428,7 @@ void rt_hw_serial_isr(struct rt_serial_device *serial)
*/
void rt_hw_serial_dma_tx_isr(struct rt_serial_device *serial)
{
void *data_ptr;
const void *data_ptr;
rt_size_t data_size;
if (RT_EOK == rt_data_queue_pop(&(serial->tx_dq), &data_ptr, &data_size, 0))

View File

@ -54,6 +54,7 @@ int clock_time_to_tick(const struct timespec *time)
return tick;
}
RTM_EXPORT(clock_time_to_tick);
int clock_getres (clockid_t clockid, struct timespec *res)
{
@ -68,6 +69,7 @@ int clock_getres (clockid_t clockid, struct timespec *res)
return 0;
}
RTM_EXPORT(clock_getres);
int clock_gettime (clockid_t clockid, struct timespec *tp)
{
@ -87,6 +89,7 @@ int clock_gettime (clockid_t clockid, struct timespec *tp)
return 0;
}
RTM_EXPORT(clock_gettime);
int clock_settime (clockid_t clockid, const struct timespec *tp)
{
@ -120,3 +123,4 @@ int clock_settime (clockid_t clockid, const struct timespec *tp)
return 0;
}
RTM_EXPORT(clock_settime);

View File

@ -68,6 +68,7 @@ int mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat,
rt_set_errno(-RT_ERROR);
return -1;
}
RTM_EXPORT(mq_setattr);
int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat)
{
@ -84,6 +85,7 @@ int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat)
return 0;
}
RTM_EXPORTO(mq_getattr);
mqd_t mq_open(const char *name, int oflag, ...)
{
@ -165,6 +167,7 @@ __return:
}
return RT_NULL;
}
RTM_EXPORT(mq_open);
ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio)
{
@ -183,6 +186,7 @@ ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_pri
rt_set_errno(EBADF);
return -1;
}
RTM_EXPORT(mq_receive);
int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio)
{
@ -201,6 +205,7 @@ int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio)
rt_set_errno(EBADF);
return -1;
}
RTM_EXPORT(mq_send);
ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len,
unsigned *msg_prio, const struct timespec *abs_timeout)
@ -227,6 +232,7 @@ ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len,
return -1;
}
RTM_EXPORT(mq_timedreceive);
int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio,
const struct timespec *abs_timeout)
@ -234,12 +240,14 @@ int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_
/* RT-Thread does not support timed send */
return mq_send(mqdes, msg_ptr, msg_len, msg_prio);
}
RTM_EXPORT(mq_timedsend);
int mq_notify(mqd_t mqdes, const struct sigevent *notification)
{
rt_set_errno(-RT_ERROR);
return -1;
}
RTM_EXPORT(mq_notify);
int mq_close(mqd_t mqdes)
{
@ -262,6 +270,7 @@ int mq_close(mqd_t mqdes)
return 0;
}
RTM_EXPORT(mq_close);
int mq_unlink(const char *name)
{
@ -287,3 +296,4 @@ int mq_unlink(const char *name)
rt_set_errno(ENOENT);
return -1;
}
RTM_EXPORT(mq_unlink);

View File

@ -145,6 +145,7 @@ int pthread_create (pthread_t *tid, const pthread_attr_t *attr,
rt_free(ptd);
return EINVAL;
}
RTM_EXPORT(pthread_create);
int pthread_detach(pthread_t thread)
{
@ -189,6 +190,7 @@ int pthread_detach(pthread_t thread)
return 0;
}
RTM_EXPORT(pthread_detach);
int pthread_join (pthread_t thread, void **value_ptr)
{
@ -218,6 +220,7 @@ int pthread_join (pthread_t thread, void **value_ptr)
return 0;
}
RTM_EXPORT(pthread_join);
void pthread_exit (void* value)
{
@ -277,6 +280,7 @@ void pthread_exit (void* value)
/* reschedule thread */
rt_schedule();
}
RTM_EXPORT(pthread_exit);
int pthread_once(pthread_once_t * once_control, void (*init_routine) (void))
{
@ -296,16 +300,19 @@ int pthread_once(pthread_once_t * once_control, void (*init_routine) (void))
return 0;
}
RTM_EXPORT(pthread_once);
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void))
{
return ENOTSUP;
}
RTM_EXPORT(pthread_atfork);
int pthread_kill(pthread_t thread, int sig)
{
return ENOTSUP;
}
RTM_EXPORT(pthread_kill);
void pthread_cleanup_pop(int execute)
{
@ -332,6 +339,7 @@ void pthread_cleanup_pop(int execute)
}
}
}
RTM_EXPORT(pthread_cleanup_pop);
void pthread_cleanup_push(void (*routine)(void*), void *arg)
{
@ -354,6 +362,7 @@ void pthread_cleanup_push(void (*routine)(void*), void *arg)
rt_exit_critical();
}
}
RTM_EXPORT(pthread_cleanup_push);
/*
* According to IEEE Std 1003.1, 2004 Edition , following pthreads
@ -401,6 +410,7 @@ int pthread_setcancelstate(int state, int *oldstate)
return EINVAL;
}
RTM_EXPORT(pthread_setcancelstate);
int pthread_setcanceltype(int type, int *oldtype)
{
@ -418,6 +428,7 @@ int pthread_setcanceltype(int type, int *oldtype)
return 0;
}
RTM_EXPORT(pthread_setcanceltype);
void pthread_testcancel(void)
{
@ -431,6 +442,7 @@ void pthread_testcancel(void)
if (ptd->cancelstate == PTHREAD_CANCEL_ENABLE) cancel = ptd->canceled;
if (cancel) pthread_exit((void*)PTHREAD_CANCELED);
}
RTM_EXPORT(pthread_testcancel);
int pthread_cancel(pthread_t thread)
{
@ -462,3 +474,5 @@ int pthread_cancel(pthread_t thread)
return 0;
}
RTM_EXPORT(pthread_cancel);

View File

@ -24,6 +24,7 @@ int pthread_attr_init(pthread_attr_t *attr)
return 0;
}
RTM_EXPORT(pthread_attr_init);
int pthread_attr_destroy(pthread_attr_t *attr)
{
@ -32,6 +33,7 @@ int pthread_attr_destroy(pthread_attr_t *attr)
memset(attr, 0, sizeof(pthread_attr_t));
return 0;
}
RTM_EXPORT(pthread_attr_destroy);
int pthread_attr_setdetachstate(pthread_attr_t * attr, int state)
{
@ -43,6 +45,7 @@ int pthread_attr_setdetachstate(pthread_attr_t * attr, int state)
attr->detachstate = state;
return 0;
}
RTM_EXPORT(pthread_attr_setdetachstate);
int pthread_attr_getdetachstate(pthread_attr_t const * attr, int *state)
{
@ -52,6 +55,7 @@ int pthread_attr_getdetachstate(pthread_attr_t const * attr, int *state)
return 0;
}
RTM_EXPORT(pthread_attr_getdetachstate);
int pthread_attr_setschedpolicy(pthread_attr_t * attr, int policy)
{
@ -60,6 +64,7 @@ int pthread_attr_setschedpolicy(pthread_attr_t * attr, int policy)
attr->policy = policy;
return 0;
}
RTM_EXPORT(pthread_attr_setschedpolicy);
int pthread_attr_getschedpolicy(pthread_attr_t const *attr, int *policy)
{
@ -68,6 +73,7 @@ int pthread_attr_getschedpolicy(pthread_attr_t const *attr, int *policy)
*policy = (int)attr->policy;
return 0;
}
RTM_EXPORT(pthread_attr_getschedpolicy);
int pthread_attr_setschedparam(pthread_attr_t *attr, struct sched_param const *param)
{
@ -77,6 +83,7 @@ int pthread_attr_setschedparam(pthread_attr_t *attr, struct sched_param const *p
attr->priority = param->sched_priority;
return 0;
}
RTM_EXPORT(pthread_attr_setschedparam);
int pthread_attr_getschedparam(pthread_attr_t const *attr, struct sched_param *param)
{
@ -86,6 +93,7 @@ int pthread_attr_getschedparam(pthread_attr_t const *attr, struct sched_param *p
param->sched_priority = attr->priority;
return 0;
}
RTM_EXPORT(pthread_attr_getschedparam);
int pthread_attr_setstacksize(pthread_attr_t * attr, size_t stack_size)
{
@ -94,6 +102,7 @@ int pthread_attr_setstacksize(pthread_attr_t * attr, size_t stack_size)
attr->stack_size = stack_size;
return 0;
}
RTM_EXPORT(pthread_attr_setstacksize);
int pthread_attr_getstacksize(pthread_attr_t const * attr, size_t *stack_size)
{
@ -102,18 +111,21 @@ int pthread_attr_getstacksize(pthread_attr_t const * attr, size_t *stack_size)
*stack_size = attr->stack_size;
return 0;
}
RTM_EXPORT(pthread_attr_getstacksize);
int pthread_attr_setstackaddr(pthread_attr_t * attr, void * stack_addr)
{
RT_ASSERT(attr != RT_NULL);
return ENOTSUP;
}
RTM_EXPORT(pthread_attr_setstackaddr);
int pthread_attr_getstackaddr(pthread_attr_t const * attr, void ** stack_addr)
{
RT_ASSERT(attr != RT_NULL);
return ENOTSUP;
}
RTM_EXPORT(pthread_attr_getstackaddr);
int pthread_attr_setstack(pthread_attr_t * attr, void *stack_base, size_t stack_size)
{
@ -124,6 +136,7 @@ int pthread_attr_setstack(pthread_attr_t * attr, void *stack_base, size_t stack_
return 0;
}
RTM_EXPORT(pthread_attr_setstack);
int pthread_attr_getstack(pthread_attr_t const * attr, void **stack_base, size_t *stack_size)
{
@ -134,6 +147,7 @@ int pthread_attr_getstack(pthread_attr_t const * attr, void **stack_base, size_t
return 0;
}
RTM_EXPORT(pthread_attr_getstack);
int pthread_attr_setguardsize(pthread_attr_t * attr, size_t guard_size)
{
@ -144,6 +158,7 @@ int pthread_attr_getguardsize(pthread_attr_t const * attr, size_t *guard_size)
{
return ENOTSUP;
}
RTM_EXPORT(pthread_attr_getguardsize);
int pthread_attr_setscope(pthread_attr_t *attr, int scope)
{
@ -154,9 +169,10 @@ int pthread_attr_setscope(pthread_attr_t *attr, int scope)
return EINVAL;
}
RTM_EXPORT(pthread_attr_setscope);
int pthread_attr_getscope(pthread_attr_t const *attr)
{
return PTHREAD_SCOPE_SYSTEM;
}
RTM_EXPORT(pthread_attr_getscope);

View File

@ -5,6 +5,7 @@ int pthread_barrierattr_destroy(pthread_barrierattr_t *attr)
if (!attr) return EINVAL;
return 0;
}
RTM_EXPORT(pthread_barrierattr_destroy);
int pthread_barrierattr_init(pthread_barrierattr_t *attr)
{
@ -13,6 +14,7 @@ int pthread_barrierattr_init(pthread_barrierattr_t *attr)
return 0;
}
RTM_EXPORT(pthread_barrierattr_init);
int pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr, int *pshared)
{
@ -21,6 +23,7 @@ int pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr, int *pshar
return 0;
}
RTM_EXPORT(pthread_barrierattr_getpshared);
int pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared)
{
@ -29,6 +32,7 @@ int pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared)
return EINVAL;
}
RTM_EXPORT(pthread_barrierattr_setpshared);
int pthread_barrier_destroy(pthread_barrier_t *barrier)
{
@ -40,6 +44,7 @@ int pthread_barrier_destroy(pthread_barrier_t *barrier)
return result;
}
RTM_EXPORT(pthread_barrier_destroy);
int pthread_barrier_init(pthread_barrier_t *barrier,
const pthread_barrierattr_t *attr, unsigned count)
@ -53,6 +58,7 @@ int pthread_barrier_init(pthread_barrier_t *barrier,
return 0;
}
RTM_EXPORT(pthread_barrier_init);
int pthread_barrier_wait(pthread_barrier_t *barrier)
{
@ -75,4 +81,5 @@ int pthread_barrier_wait(pthread_barrier_t *barrier)
pthread_mutex_unlock(&(barrier->mutex));
return result;
}
RTM_EXPORT(pthread_barrier_wait);

View File

@ -7,6 +7,7 @@ int pthread_condattr_destroy(pthread_condattr_t *attr)
return 0;
}
RTM_EXPORT(pthread_condattr_destroy);
int pthread_condattr_init(pthread_condattr_t *attr)
{
@ -15,18 +16,21 @@ int pthread_condattr_init(pthread_condattr_t *attr)
return 0;
}
RTM_EXPORT(pthread_condattr_init);
int pthread_condattr_getclock(const pthread_condattr_t *attr,
clockid_t *clock_id)
{
return 0;
}
RTM_EXPORT(pthread_condattr_getclock);
int pthread_condattr_setclock(pthread_condattr_t *attr,
clockid_t clock_id)
{
return 0;
}
RTM_EXPORT(pthread_condattr_setclock);
int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared)
{
@ -35,6 +39,7 @@ int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared)
*pshared = PTHREAD_PROCESS_PRIVATE;
return 0;
}
RTM_EXPORT(pthread_condattr_getpshared);
int pthread_condattr_setpshared(pthread_condattr_t*attr, int pshared)
{
@ -46,6 +51,7 @@ int pthread_condattr_setpshared(pthread_condattr_t*attr, int pshared)
return 0;
}
RTM_EXPORT(pthread_condattr_setpshared);
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
{
@ -69,6 +75,7 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
return 0;
}
RTM_EXPORT(pthread_cond_init);
int pthread_cond_destroy(pthread_cond_t *cond)
{
@ -85,6 +92,7 @@ int pthread_cond_destroy(pthread_cond_t *cond)
return 0;
}
RTM_EXPORT(pthread_cond_destroy);
int pthread_cond_broadcast(pthread_cond_t *cond)
{
@ -118,6 +126,7 @@ int pthread_cond_broadcast(pthread_cond_t *cond)
return 0;
}
RTM_EXPORT(pthread_cond_broadcast);
int pthread_cond_signal(pthread_cond_t *cond)
{
@ -131,6 +140,7 @@ int pthread_cond_signal(pthread_cond_t *cond)
return 0;
}
RTM_EXPORT(pthread_cond_signal);
rt_err_t _pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
rt_int32_t timeout)
@ -152,6 +162,7 @@ rt_err_t _pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
pthread_mutex_lock(mutex);
return result;
}
RTM_EXPORT(_pthread_cond_timedwait);
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
@ -162,6 +173,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
return EINVAL;
}
RTM_EXPORT(pthread_cond_wait);
int pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t * mutex,
@ -177,3 +189,5 @@ int pthread_cond_timedwait(pthread_cond_t *cond,
return EINVAL;
}
RTM_EXPORT(pthread_cond_timedwait);

View File

@ -16,6 +16,7 @@ int pthread_mutexattr_init(pthread_mutexattr_t *attr)
return EINVAL;
}
RTM_EXPORT(pthread_mutexattr_init);
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
{
@ -27,6 +28,7 @@ int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
return EINVAL;
}
RTM_EXPORT(pthread_mutexattr_destroy);
int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type)
{
@ -43,6 +45,7 @@ int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type)
return EINVAL;
}
RTM_EXPORT(pthread_mutexattr_gettype);
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
{
@ -55,6 +58,7 @@ int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
return EINVAL;
}
RTM_EXPORT(pthread_mutexattr_settype);
int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
{
@ -73,6 +77,7 @@ int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
return EINVAL;
}
RTM_EXPORT(pthread_mutexattr_setpshared);
int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared)
{
@ -82,6 +87,7 @@ int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared)
: PTHREAD_PROCESS_PRIVATE;
return 0;
}
RTM_EXPORT(pthread_mutexattr_getpshared);
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
{
@ -105,6 +111,7 @@ int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
return 0;
}
RTM_EXPORT(pthread_mutex_init);
int pthread_mutex_destroy(pthread_mutex_t *mutex)
{
@ -118,6 +125,7 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex)
return 0;
}
RTM_EXPORT(pthread_mutex_destroy);
int pthread_mutex_lock(pthread_mutex_t *mutex)
{
@ -146,6 +154,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex)
return EINVAL;
}
RTM_EXPORT(pthread_mutex_lock);
int pthread_mutex_unlock(pthread_mutex_t *mutex)
{
@ -175,6 +184,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex)
return EINVAL;
}
RTM_EXPORT(pthread_mutex_unlock);
int pthread_mutex_trylock(pthread_mutex_t *mutex)
{
@ -192,4 +202,5 @@ int pthread_mutex_trylock(pthread_mutex_t *mutex)
return EBUSY;
}
RTM_EXPORT(pthread_mutex_trylock);

View File

@ -7,6 +7,7 @@ int pthread_rwlockattr_init (pthread_rwlockattr_t * attr)
return 0;
}
RTM_EXPORT(pthread_rwlockattr_init);
int pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr)
{
@ -14,6 +15,7 @@ int pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr)
return 0;
}
RTM_EXPORT(pthread_rwlockattr_destroy);
int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr, int *pshared)
{
@ -22,6 +24,7 @@ int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr, int *pshar
*pshared = PTHREAD_PROCESS_PRIVATE;
return 0;
}
RTM_EXPORT(pthread_rwlockattr_getpshared);
int pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr, int pshared)
{
@ -29,6 +32,7 @@ int pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr, int pshared)
return 0;
}
RTM_EXPORT(pthread_rwlockattr_setpshared);
int pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t * attr)
{
@ -45,6 +49,7 @@ int pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *
return 0;
}
RTM_EXPORT(pthread_rwlock_init);
int pthread_rwlock_destroy (pthread_rwlock_t *rwlock)
{
@ -91,6 +96,7 @@ int pthread_rwlock_destroy (pthread_rwlock_t *rwlock)
return result;
}
RTM_EXPORT(pthread_rwlock_destroy);
int pthread_rwlock_rdlock (pthread_rwlock_t *rwlock)
{
@ -118,6 +124,7 @@ int pthread_rwlock_rdlock (pthread_rwlock_t *rwlock)
pthread_mutex_unlock(&rwlock->rw_mutex);
return (result);
}
RTM_EXPORT(pthread_rwlock_rdlock);
int pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
{
@ -137,6 +144,7 @@ int pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
pthread_mutex_unlock(&rwlock->rw_mutex);
return(result);
}
RTM_EXPORT(pthread_rwlock_tryrdlock);
int pthread_rwlock_timedrdlock (pthread_rwlock_t * rwlock, const struct timespec *abstime)
{
@ -164,6 +172,7 @@ int pthread_rwlock_timedrdlock (pthread_rwlock_t * rwlock, const struct timespec
pthread_mutex_unlock(&rwlock->rw_mutex);
return (result);
}
RTM_EXPORT(pthread_rwlock_timedrdlock);
int pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, const struct timespec *abstime)
{
@ -189,6 +198,7 @@ int pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, const struct timespec
pthread_mutex_unlock(&rwlock->rw_mutex);
return(result);
}
RTM_EXPORT(pthread_rwlock_timedwrlock);
int pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock)
{
@ -208,6 +218,7 @@ int pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock)
pthread_mutex_unlock(&rwlock->rw_mutex);
return(result);
}
RTM_EXPORT(pthread_rwlock_trywrlock);
int pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
{
@ -238,6 +249,7 @@ int pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
pthread_mutex_unlock(&rwlock->rw_mutex);
return(result);
}
RTM_EXPORT(pthread_rwlock_unlock);
int pthread_rwlock_wrlock (pthread_rwlock_t *rwlock)
{
@ -263,4 +275,5 @@ int pthread_rwlock_wrlock (pthread_rwlock_t *rwlock)
pthread_mutex_unlock(&rwlock->rw_mutex);
return(result);
}
RTM_EXPORT(pthread_rwlock_wrlock);

View File

@ -22,6 +22,7 @@ void *pthread_getspecific(pthread_key_t key)
return NULL;
}
RTM_EXPORT(pthread_getspecific);
int pthread_setspecific(pthread_key_t key, const void *value)
{
@ -44,6 +45,7 @@ int pthread_setspecific(pthread_key_t key, const void *value)
return EINVAL;
}
RTM_EXPORT(pthread_setspecific);
int pthread_key_create(pthread_key_t *key, void (*destructor)(void*))
{
@ -67,6 +69,7 @@ int pthread_key_create(pthread_key_t *key, void (*destructor)(void*))
rt_exit_critical();
return EAGAIN;
}
RTM_EXPORT(pthread_key_create);
int pthread_key_delete(pthread_key_t key)
{
@ -79,4 +82,5 @@ int pthread_key_delete(pthread_key_t key)
return 0;
}
RTM_EXPORT(pthread_key_delete);

View File

@ -5,6 +5,7 @@ int sched_yield(void)
rt_thread_yield();
return 0;
}
RTM_EXPORT(sched_yield);
int sched_get_priority_min(int policy)
{
@ -13,6 +14,7 @@ int sched_get_priority_min(int policy)
return 0;
}
RTM_EXPORT(sched_get_priority_min);
int sched_get_priority_max(int policy)
{
@ -21,8 +23,10 @@ int sched_get_priority_max(int policy)
return RT_THREAD_PRIORITY_MAX - 1;
}
RTM_EXPORT(sched_get_priority_max);
int sched_setscheduler(pid_t pid, int policy)
{
return ENOTSUP;
}
RTM_EXPORT(sched_setscheduler);

View File

@ -1,6 +1,6 @@
#include <rtthread.h>
#include "semaphore.h"
#include "pthread_internal.h"
#include "pthread_internal.h"
static sem_t* posix_sem_list = RT_NULL;
static struct rt_semaphore posix_sem_lock;
@ -58,8 +58,8 @@ static sem_t *posix_sem_find(const char* name)
{
return iter;
}
}
}
return RT_NULL;
}
@ -85,6 +85,7 @@ int sem_close(sem_t *sem)
return 0;
}
RTM_EXPORT(sem_close);
int sem_destroy(sem_t *sem)
{
@ -112,6 +113,7 @@ int sem_destroy(sem_t *sem)
return 0;
}
RTM_EXPORT(sem_destroy);
int sem_unlink(const char *name)
{
@ -137,6 +139,7 @@ int sem_unlink(const char *name)
rt_set_errno(ENOENT);
return -1;
}
RTM_EXPORT(sem_unlink);
int sem_getvalue(sem_t *sem, int *sval)
{
@ -148,6 +151,7 @@ int sem_getvalue(sem_t *sem, int *sval)
*sval = sem->sem->value;
return 0;
}
RTM_EXPORT(sem_getvalue);
int sem_init(sem_t *sem, int pshared, unsigned int value)
{
@ -179,6 +183,7 @@ int sem_init(sem_t *sem, int pshared, unsigned int value)
return 0;
}
RTM_EXPORT(sem_init);
sem_t *sem_open(const char *name, int oflag, ...)
{
@ -259,6 +264,7 @@ __return:
}
return RT_NULL;
}
RTM_EXPORT(sem_open);
int sem_post(sem_t *sem)
{
@ -276,6 +282,7 @@ int sem_post(sem_t *sem)
rt_set_errno(EINVAL);
return -1;
}
RTM_EXPORT(sem_post);
int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout)
{
@ -298,6 +305,7 @@ int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout)
rt_set_errno(EINTR);
return -1;
}
RTM_EXPORT(sem_timedwait);
int sem_trywait(sem_t *sem)
{
@ -320,6 +328,7 @@ int sem_trywait(sem_t *sem)
rt_set_errno(EINTR);
return -1;
}
RTM_EXPORT(sem_trywait);
int sem_wait(sem_t *sem)
{
@ -337,4 +346,5 @@ int sem_wait(sem_t *sem)
rt_set_errno(EINTR);
return -1;
}
RTM_EXPORT(sem_wait);