Пример #1
0
void rtcan_socket_cleanup(struct rtdm_dev_context *context)
{
    struct rtcan_socket *sock = (struct rtcan_socket *)&context->dev_private;
    struct tx_wait_queue *tx_waiting;
    rtdm_lockctx_t lock_ctx;
    int tx_list_empty;


    /* Wake up sleeping senders. This is re-entrant-safe. */
    do {
        RTDM_EXECUTE_ATOMICALLY(
            /* Is someone there? */
            if (list_empty(&sock->tx_wait_head))
                tx_list_empty = 1;

            else {
                tx_list_empty = 0;

                /* Get next entry pointing to a waiting task */
                tx_waiting = list_entry(sock->tx_wait_head.next,
                                        struct tx_wait_queue, tx_wait_list);

                /* Remove it from list */
                list_del(&tx_waiting->tx_wait_list);

                /* Wake task up (atomic section is left implicitly) */
                rtdm_task_unblock(tx_waiting->rt_task);
            }
        );
    } while (!tx_list_empty);
Пример #2
0
static void tdma_dev_close(struct rtdm_fd *fd)
{
    struct tdma_dev_ctx *ctx = rtdm_fd_to_private(fd);


    RTDM_EXECUTE_ATOMICALLY(
	if (ctx->cycle_waiter)
	    rtdm_task_unblock(ctx->cycle_waiter);
			    );
Пример #3
0
void rtcan_socket_cleanup(struct rtdm_fd *fd)
{
    struct rtcan_socket *sock = rtdm_fd_to_private(fd);
    struct tx_wait_queue *tx_waiting;
    rtdm_lockctx_t lock_ctx;
    int tx_list_empty;


    /* Wake up sleeping senders. This is re-entrant-safe. */
    do {
	cobalt_atomic_enter(lock_ctx);
	/* Is someone there? */
	if (list_empty(&sock->tx_wait_head))
		tx_list_empty = 1;
	else {
		tx_list_empty = 0;

		/* Get next entry pointing to a waiting task */
		tx_waiting = list_entry(sock->tx_wait_head.next,
					struct tx_wait_queue, tx_wait_list);

		/* Remove it from list */
		list_del(&tx_waiting->tx_wait_list);

		/* Wake task up (atomic section is left implicitly) */
		rtdm_task_unblock(tx_waiting->rt_task);
	}
	cobalt_atomic_leave(lock_ctx);
    } while (!tx_list_empty);

    rtdm_sem_destroy(&sock->recv_sem);

    rtdm_lock_get_irqsave(&rtcan_recv_list_lock, lock_ctx);
    if (sock->socket_list.next) {
	list_del(&sock->socket_list);
	sock->socket_list.next = NULL;
    }
    rtdm_lock_put_irqrestore(&rtcan_recv_list_lock, lock_ctx);
}