Browse Source

posix: Remove _t from struct names

pr/spi.typo
DipSwitch 7 years ago
parent
commit
21edec412a
  1. 4
      sys/posix/pthread/include/pthread_barrier.h
  2. 20
      sys/posix/pthread/include/pthread_cond.h
  3. 2
      sys/posix/pthread/include/pthread_mutex_attr.h
  4. 4
      sys/posix/pthread/include/pthread_rwlock.h
  5. 2
      sys/posix/pthread/include/pthread_rwlock_attr.h
  6. 2
      sys/posix/pthread/include/pthread_threading_attr.h
  7. 8
      sys/posix/pthread/pthread.c
  8. 16
      sys/posix/pthread/pthread_cond.c
  9. 2
      tests/pthread_condition_variable/main.c

4
sys/posix/pthread/include/pthread_barrier.h

@ -54,7 +54,7 @@ typedef struct pthread_barrier_waiting_node
* For a zeroed out datum you do not need to call the initializer,
* it is enough to set pthread_barrier_t::count.
*/
typedef struct pthread_barrier
typedef struct
{
struct pthread_barrier_waiting_node *next; /**< The first waiting thread. */
mutex_t mutex; /**< Mutex to unlock to wake the thread up. */
@ -66,7 +66,7 @@ typedef struct pthread_barrier
* @details RIOT does not need this structure, because it is a single process OS.
* This is only here to POSIX compatibility.
*/
typedef struct pthread_barrierattr
typedef struct
{
int pshared; /**< See pthread_barrierattr_setpshared() and pthread_barrierattr_getpshared(). */
} pthread_barrierattr_t;

20
sys/posix/pthread/include/pthread_cond.h

@ -36,7 +36,7 @@ extern "C" {
/**
* @note condition attributes are currently NOT USED in RIOT condition variables
*/
typedef struct pthread_condattr_t {
typedef struct {
/** dumdidum */
int __dummy;
} pthread_condattr_t;
@ -46,7 +46,7 @@ typedef struct pthread_condattr_t {
*
* @warning fields are managed by cv functions, don't touch
*/
typedef struct pthread_cond_t {
typedef struct {
priority_queue_t queue; /**< Threads currently waiting to be signaled. */
} pthread_cond_t;
@ -55,14 +55,14 @@ typedef struct pthread_cond_t {
* @param[in, out] attr pre-allocated condition attribute variable structure.
* @return returns 0 on success, an errorcode otherwise.
*/
int pthread_cond_condattr_init(struct pthread_condattr_t *attr);
int pthread_cond_condattr_init(pthread_condattr_t *attr);
/**
* @brief Uninitializes a condition attribute variable object
* @param[in, out] attr pre-allocated condition attribute variable structure.
* @return returns 0 on success, an errorcode otherwise.
*/
int pthread_cond_condattr_destroy(struct pthread_condattr_t *attr);
int pthread_cond_condattr_destroy(pthread_condattr_t *attr);
/**
* @brief Get the process-shared attribute in an initialised attributes object referenced by attr
@ -106,14 +106,14 @@ int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id);
* @param[in] attr pre-allocated condition attribute variable structure.
* @return returns 0 on success, an errorcode otherwise.
*/
int pthread_cond_init(struct pthread_cond_t *cond, struct pthread_condattr_t *attr);
int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr);
/**
* @brief Destroy the condition variable cond
* @param[in, out] cond pre-allocated condition variable structure.
* @return returns 0 on success, an errorcode otherwise.
*/
int pthread_cond_destroy(struct pthread_cond_t *cond);
int pthread_cond_destroy(pthread_cond_t *cond);
/**
* @brief blocks the calling thread until the specified condition cond is signalled
@ -121,7 +121,7 @@ int pthread_cond_destroy(struct pthread_cond_t *cond);
* @param[in, out] mutex pre-allocated mutex variable structure.
* @return returns 0 on success, an errorcode otherwise.
*/
int pthread_cond_wait(struct pthread_cond_t *cond, mutex_t *mutex);
int pthread_cond_wait(pthread_cond_t *cond, mutex_t *mutex);
/**
* @brief blocks the calling thread until the specified condition cond is signalled
@ -130,21 +130,21 @@ int pthread_cond_wait(struct pthread_cond_t *cond, mutex_t *mutex);
* @param[in] abstime pre-allocated timeout.
* @return returns 0 on success, an errorcode otherwise.
*/
int pthread_cond_timedwait(struct pthread_cond_t *cond, mutex_t *mutex, const struct timespec *abstime);
int pthread_cond_timedwait(pthread_cond_t *cond, mutex_t *mutex, const struct timespec *abstime);
/**
* @brief unblock at least one of the threads that are blocked on the specified condition variable cond
* @param[in, out] cond pre-allocated condition variable structure.
* @return returns 0 on success, an errorcode otherwise.
*/
int pthread_cond_signal(struct pthread_cond_t *cond);
int pthread_cond_signal(pthread_cond_t *cond);
/**
* @brief unblock all threads that are currently blocked on the specified condition variable cond
* @param[in, out] cond pre-allocated condition variable structure.
* @return returns 0 on success, an errorcode otherwise.
*/
int pthread_cond_broadcast(struct pthread_cond_t *cond);
int pthread_cond_broadcast(pthread_cond_t *cond);
#ifdef __cplusplus
}

2
sys/posix/pthread/include/pthread_mutex_attr.h

@ -85,7 +85,7 @@ extern "C" {
/**
* @brief This type is unused right now, and only exists for POSIX compatibility.
*/
typedef struct pthread_mutexattr
typedef struct
{
int pshared; /**< Whether to share the mutex with child processes. */
int kind; /**< Type of the mutex. */

4
sys/posix/pthread/include/pthread_rwlock.h

@ -34,7 +34,7 @@ extern "C" {
* E.g. no new readers will get into the critical section
* if a writer of the same or a higher priority already waits for the lock.
*/
typedef struct pthread_rwlock
typedef struct
{
/**
* @brief The current amount of reader inside the critical section.
@ -59,7 +59,7 @@ typedef struct pthread_rwlock
/**
* @brief Internal structure that stores one waiting thread.
*/
typedef struct __pthread_rwlock_waiter_node {
typedef struct {
bool is_writer; /**< `false`: reader; `true`: writer */
thread_t *thread; /**< waiting thread */
priority_queue_node_t qnode; /**< Node to store in `pthread_rwlock_t::queue`. */

2
sys/posix/pthread/include/pthread_rwlock_attr.h

@ -27,7 +27,7 @@ extern "C" {
* @brief Attributes for a new reader/writer lock.
* @details The options set in this struct will be ignored by pthread_rwlock_init().
*/
typedef struct pthread_rwlockattr
typedef struct
{
/**
* @brief Whether to share lock with child processes.

2
sys/posix/pthread/include/pthread_threading_attr.h

@ -26,7 +26,7 @@ extern "C" {
* @details A zeroed out datum is default initiliazed.
* @see pthread_create() for further information
*/
typedef struct pthread_attr
typedef struct
{
uint8_t detached; /**< Start in detached state. */
char *ss_sp; /**< Stack to use for new thread. */

8
sys/posix/pthread/pthread.c

@ -46,16 +46,16 @@
#include "debug.h"
enum pthread_thread_status {
typedef enum {
PTS_RUNNING,
PTS_DETACHED,
PTS_ZOMBIE,
};
} pthread_thread_status_t;
typedef struct pthread_thread {
typedef struct {
kernel_pid_t thread_pid;
enum pthread_thread_status status;
pthread_thread_status_t status;
kernel_pid_t joining_thread;
void *returnval;
bool should_cancel;

16
sys/posix/pthread/pthread_cond.c

@ -26,7 +26,7 @@
#include "irq.h"
#include "debug.h"
int pthread_cond_condattr_destroy(struct pthread_condattr_t *attr)
int pthread_cond_condattr_destroy(pthread_condattr_t *attr)
{
if (attr != NULL) {
DEBUG("pthread_cond_condattr_destroy: currently attributes are not supported.\n");
@ -35,7 +35,7 @@ int pthread_cond_condattr_destroy(struct pthread_condattr_t *attr)
return 0;
}
int pthread_cond_condattr_init(struct pthread_condattr_t *attr)
int pthread_cond_condattr_init(pthread_condattr_t *attr)
{
if (attr != NULL) {
DEBUG("pthread_cond_condattr_init: currently attributes are not supported.\n");
@ -76,7 +76,7 @@ int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id)
return 0;
}
int pthread_cond_init(struct pthread_cond_t *cond, struct pthread_condattr_t *attr)
int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr)
{
if (attr != NULL) {
DEBUG("pthread_cond_init: currently attributes are not supported.\n");
@ -86,13 +86,13 @@ int pthread_cond_init(struct pthread_cond_t *cond, struct pthread_condattr_t *at
return 0;
}
int pthread_cond_destroy(struct pthread_cond_t *cond)
int pthread_cond_destroy(pthread_cond_t *cond)
{
pthread_cond_init(cond, NULL);
return 0;
}
int pthread_cond_wait(struct pthread_cond_t *cond, mutex_t *mutex)
int pthread_cond_wait(pthread_cond_t *cond, mutex_t *mutex)
{
priority_queue_node_t n;
n.priority = sched_active_thread->priority;
@ -118,7 +118,7 @@ int pthread_cond_wait(struct pthread_cond_t *cond, mutex_t *mutex)
return 0;
}
int pthread_cond_timedwait(struct pthread_cond_t *cond, mutex_t *mutex, const struct timespec *abstime)
int pthread_cond_timedwait(pthread_cond_t *cond, mutex_t *mutex, const struct timespec *abstime)
{
timex_t now, then, reltime;
@ -135,7 +135,7 @@ int pthread_cond_timedwait(struct pthread_cond_t *cond, mutex_t *mutex, const st
return result;
}
int pthread_cond_signal(struct pthread_cond_t *cond)
int pthread_cond_signal(pthread_cond_t *cond)
{
unsigned old_state = irq_disable();
@ -164,7 +164,7 @@ static int max_prio(int a, int b)
return (a < 0) ? b : ((a < b) ? a : b);
}
int pthread_cond_broadcast(struct pthread_cond_t *cond)
int pthread_cond_broadcast(pthread_cond_t *cond)
{
unsigned old_state = irq_disable();

2
tests/pthread_condition_variable/main.c

@ -23,7 +23,7 @@
#include "thread.h"
static mutex_t mutex = MUTEX_INIT;
static struct pthread_cond_t cv;
static pthread_cond_t cv;
static volatile int is_finished;
static volatile long count;
static volatile long expected_value;

Loading…
Cancel
Save