mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
rewrite posix semaphore and mqueue implementation.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1103 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
1 parent
558023a020
commit
1b014359b0
6 files changed
+524
-67
No files matched your search
+199
-25
File diff suppressed because it is too large.
Load diff
@@ -7,7 +7,26 @@
|
||||
#include <sys/signal.h>
|
||||
#include <pthread.h>
|
||||
|
||||
typedef rt_mq_t mqd_t;
|
||||
struct posix_mq
|
||||
{
|
||||
/* reference count and unlinked */
|
||||
rt_uint16_t refcount;
|
||||
rt_uint16_t unlinked;
|
||||
|
||||
/* RT-Thread message queue */
|
||||
rt_mq_t mq;
|
||||
/* next posix mqueue */
|
||||
struct posix_mq* next;
|
||||
};
|
||||
typedef struct posix_mq posix_mq_t;
|
||||
|
||||
struct mqdes
|
||||
{
|
||||
rt_uint32_t flags;
|
||||
posix_mq_t* mq;
|
||||
};
|
||||
typedef struct mqdes* mqd_t;
|
||||
|
||||
struct mq_attr
|
||||
{
|
||||
long mq_flags; /* Message queue flags. */
|
||||
|
||||
@@ -6,6 +6,10 @@ int pthread_system_init(void)
|
||||
{
|
||||
/* initialize key area */
|
||||
pthread_key_system_init();
|
||||
/* initialize posix mqueue */
|
||||
posix_mq_system_init();
|
||||
/* initialize posix semaphore */
|
||||
posix_sem_system_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -54,5 +54,7 @@ rt_inline _pthread_data_t* _pthread_get_data(pthread_t thread)
|
||||
}
|
||||
|
||||
extern int libc_time_to_tick(const struct timespec *time);
|
||||
void posix_mq_system_init(void);
|
||||
void posix_sem_system_init(void);
|
||||
|
||||
#endif
|
||||
+278
-40
File diff suppressed because it is too large.
Load diff
@@ -4,7 +4,27 @@
|
||||
#include <rtthread.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
typedef struct rt_semaphore sem_t;
|
||||
struct posix_sem
|
||||
{
|
||||
/* reference count and unlinked */
|
||||
rt_uint16_t refcount;
|
||||
rt_uint8_t unlinked;
|
||||
rt_uint8_t unamed;
|
||||
|
||||
/* RT-Thread semaphore */
|
||||
rt_sem_t sem;
|
||||
|
||||
/* next posix semaphore */
|
||||
struct posix_sem* next;
|
||||
};
|
||||
typedef struct posix_sem posix_sem_t;
|
||||
|
||||
struct semdes
|
||||
{
|
||||
rt_uint32_t flags;
|
||||
posix_sem_t* sem;
|
||||
};
|
||||
typedef struct semdes sem_t;
|
||||
|
||||
int sem_close(sem_t *sem);
|
||||
int sem_destroy(sem_t *sem);
|
||||
|
||||
Reference in new issue
Block a user