Skip to content

Commit

Permalink
posix: Remove _t from struct names
Browse files Browse the repository at this point in the history
  • Loading branch information
DipSwitch committed Apr 11, 2016
1 parent af96279 commit 21edec4
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions sys/posix/pthread/include/pthread_barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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;
Expand Down
20 changes: 10 additions & 10 deletions sys/posix/pthread/include/pthread_cond.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -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
Expand Down Expand Up @@ -106,22 +106,22 @@ 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
* @param[in, out] cond pre-allocated condition variable structure.
* @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
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion sys/posix/pthread/include/pthread_mutex_attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
4 changes: 2 additions & 2 deletions sys/posix/pthread/include/pthread_rwlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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`. */
Expand Down
2 changes: 1 addition & 1 deletion sys/posix/pthread/include/pthread_rwlock_attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion sys/posix/pthread/include/pthread_threading_attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
8 changes: 4 additions & 4 deletions sys/posix/pthread/pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions sys/posix/pthread/pthread_cond.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down Expand Up @@ -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");
Expand All @@ -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;
Expand All @@ -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;

Expand All @@ -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();

Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion tests/pthread_condition_variable/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 21edec4

Please sign in to comment.