Go to the documentation of this file.
60 #if (CH_CFG_USE_SEMAPHORES == TRUE) || defined(__DOXYGEN__)
78 #if CH_CFG_USE_SEMAPHORES_PRIORITY == TRUE
79 #define sem_insert(qp, tp) ch_sch_prio_insert(&tp->hdr.queue, qp)
81 #define sem_insert(qp, tp) ch_queue_insert(qp, &tp->hdr.queue)
149 "inconsistent semaphore");
197 "inconsistent semaphore");
202 sem_insert(&sp->
queue, currtp);
265 "inconsistent semaphore");
275 sem_insert(&sp->
queue, currtp);
297 "inconsistent semaphore");
321 "inconsistent semaphore");
351 "inconsistent semaphore");
353 while (n > (
cnt_t)0) {
382 "inconsistent semaphore");
385 "inconsistent semaphore");
391 sem_insert(&spw->
queue, currtp);
thread_t * chSchReadyI(thread_t *tp)
Inserts a thread in the Ready List placing it behind its peers.
msg_t rdymsg
Thread wakeup code.
void chSemAddCounterI(semaphore_t *sp, cnt_t n)
Adds the specified value to the semaphore counter.
#define chDbgAssert(c, r)
Condition assertion.
void chSemSignal(semaphore_t *sp)
Performs a signal operation on a semaphore.
msg_t chSemWait(semaphore_t *sp)
Performs a wait operation on a semaphore.
static bool ch_queue_notempty(const ch_queue_t *qp)
Evaluates to true if the specified queue is not empty.
static bool ch_queue_isempty(const ch_queue_t *qp)
Evaluates to true if the specified queue is empty.
msg_t chSchGoSleepTimeoutS(tstate_t newstate, sysinterval_t timeout)
Puts the current thread to sleep into the specified state with timeout specification.
#define chDbgCheck(c)
Function parameters check.
#define TIME_IMMEDIATE
Zero interval specification for some functions with a timeout specification.
msg_t chSemWaitS(semaphore_t *sp)
Performs a wait operation on a semaphore.
Structure representing a thread.
void chSemResetWithMessageI(semaphore_t *sp, cnt_t n, msg_t msg)
Performs a reset operation on the semaphore.
void chSchGoSleepS(tstate_t newstate)
Puts the current thread to sleep into the specified state.
void chSemObjectInit(semaphore_t *sp, cnt_t n)
Initializes a semaphore with the specified counter value.
static ch_queue_t * ch_queue_fifo_remove(ch_queue_t *qp)
Removes the first-out element from a queue and returns it.
union ch_thread::@1 u
State-specific fields.
ch_queue_t queue
Queue of the threads sleeping on this semaphore.
void chSchRescheduleS(void)
Performs a reschedule if a higher priority thread is runnable.
static void ch_queue_init(ch_queue_t *qp)
Queue initialization.
#define MSG_OK
Normal wakeup message.
cnt_t cnt
The semaphore counter.
static ch_queue_t * ch_queue_lifo_remove(ch_queue_t *qp)
Removes the last-out element from a queue and returns it.
uint64_t sysinterval_t
Type of time interval.
msg_t chSemWaitTimeout(semaphore_t *sp, sysinterval_t timeout)
Performs a wait operation on a semaphore with timeout specification.
void chSemResetWithMessage(semaphore_t *sp, cnt_t n, msg_t msg)
Performs a reset operation on the semaphore.
struct ch_semaphore * wtsemp
Pointer to a generic semaphore object.
#define unlikely(x)
Marks a boolean expression as likely false.
#define MSG_TIMEOUT
Wakeup caused by a timeout condition.
msg_t chSemSignalWait(semaphore_t *sps, semaphore_t *spw)
Performs atomic signal and wait operations on two semaphores.
msg_t chSemWaitTimeoutS(semaphore_t *sp, sysinterval_t timeout)
Performs a wait operation on a semaphore with timeout specification.
#define chSysUnlock()
Leaves the kernel lock state.
void chSemSignalI(semaphore_t *sp)
Performs a signal operation on a semaphore.
#define CH_STATE_WTSEM
On a semaphore.
void chSchWakeupS(thread_t *ntp, msg_t msg)
Wakes up a thread.
#define chThdGetSelfX()
Returns a pointer to the current thread_t.
#define chSysLock()
Enters the kernel lock state.