Пример #1
0
END_TEST

START_TEST (test_async_queue_enable)
{
    AsyncQueue *queue;
    GThread *push_thread;
    GThread *pop_thread;
    guint count;

    queue = async_queue_new ();
    fail_if (!queue,
             "Construction failed");

    pop_thread = g_thread_create (pop_with_disable_func, queue, TRUE, NULL);

    async_queue_disable (queue);

    count = GPOINTER_TO_INT (g_thread_join (pop_thread));

    fail_if (count != 0,
             "Disable failed");

    async_queue_enable (queue);

    pop_thread = g_thread_create (pop_with_disable_func, queue, TRUE, NULL);
    push_thread = g_thread_create (push_and_disable_func, queue, TRUE, NULL);

    count = GPOINTER_TO_INT (g_thread_join (pop_thread));
    g_thread_join (push_thread);

    fail_if (count > DISABLE_AT,
             "Disable failed");

    async_queue_free (queue);
}
Пример #2
0
END_TEST

static gpointer
push_and_disable_func (gpointer data)
{
    AsyncQueue *queue;
    gpointer foo;
    guint i;

    queue = data;
    foo = GINT_TO_POINTER (1);
    for (i = 0; i < DISABLE_AT; i++, foo++)
    {
        async_queue_push (queue, foo);
    }

    async_queue_disable (queue);

    return NULL;
}
Пример #3
0
void
g_omx_port_finish (GOmxPort *port)
{
    port->enabled = FALSE;
    async_queue_disable (port->queue);
}
Пример #4
0
void
g_omx_port_pause (GOmxPort *port)
{
    async_queue_disable (port->queue);
}