Exemplo n.º 1
0
int main(int argc, char **argv)
{
    long flags;
    assert(ecore_init());
    mgr = upump_ecore_mgr_alloc(UPUMP_POOL, UPUMP_BLOCKER_POOL);
    assert(mgr != NULL);

    /* Create a pipe with non-blocking write */
    assert(pipe(pipefd) != -1);
    flags = fcntl(pipefd[1], F_GETFL);
    assert(flags != -1);
    flags |= O_NONBLOCK;
    assert(fcntl(pipefd[1], F_SETFL, flags) != -1);

    /* Create watchers */
    write_idler = upump_alloc_idler(mgr, write_idler_cb, NULL, NULL);
    assert(write_idler != NULL);
    write_watcher = upump_alloc_fd_write(mgr, write_watcher_cb, NULL, NULL,
                                         pipefd[1]);
    assert(write_watcher != NULL);
    read_timer = upump_alloc_timer(mgr, read_timer_cb, NULL, NULL, timeout, 0);
    assert(read_timer != NULL);
    read_watcher = upump_alloc_fd_read(mgr, read_watcher_cb, NULL, NULL,
                                       pipefd[0]);
    assert(read_watcher != NULL);

    /* Start tests */
    upump_start(write_idler);

    ecore_main_loop_begin();
    printf("\nread: \t%zd\nwrite: \t%zd\n", bytes_read, bytes_written);
    assert(bytes_read);
    assert(bytes_read == bytes_written);

    /* Clean up */
    upump_free(write_idler);
    upump_free(write_watcher);
    upump_free(read_timer);
    upump_free(read_watcher);
    upump_mgr_release(mgr);

    ecore_shutdown();

    return 0;
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
    run(upump_ecore_mgr_alloc(UPUMP_POOL, UPUMP_BLOCKER_POOL));
    return 0;
}