/** @internal Send a message to the port. * * @retval 0 if there are other messages in queue, too * @retval -1 upon an error */ int su_base_port_send(su_port_t *self, su_msg_r rmsg) { if (self) { int wakeup; su_port_lock(self, "su_port_send"); wakeup = self->sup_head == NULL; *self->sup_tail = rmsg[0]; rmsg[0] = NULL; self->sup_tail = &(*self->sup_tail)->sum_next; su_port_unlock(self, "su_port_send"); if (wakeup > 0) su_port_wakeup(self); return 0; } else { su_msg_destroy(rmsg); return -1; } }
/** Wakeup a task. * * Wake up a task. This function is mainly useful when using deferrable * timers executed upon wakeup. * * @param task task handle * * @retval 0 if succesful * @retval -1 upon an error * * @NEW_1_12_11 */ int su_task_wakeup(su_task_r const task) { return task ? su_port_wakeup(task->sut_port) : -1; }