您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ APR_STATUS_IS_TIMEUP函数代码示例

51自学网 2021-06-01 19:35:46
  C++
这篇教程C++ APR_STATUS_IS_TIMEUP函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中APR_STATUS_IS_TIMEUP函数的典型用法代码示例。如果您正苦于以下问题:C++ APR_STATUS_IS_TIMEUP函数的具体用法?C++ APR_STATUS_IS_TIMEUP怎么用?C++ APR_STATUS_IS_TIMEUP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了APR_STATUS_IS_TIMEUP函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: serf_context_run

apr_status_t serf_context_run(    serf_context_t *ctx,    apr_short_interval_time_t duration,    apr_pool_t *pool){    apr_status_t status;    apr_int32_t num;    const apr_pollfd_t *desc;    serf_pollset_t *ps = (serf_pollset_t*)ctx->pollset_baton;    if ((status = serf_context_prerun(ctx)) != APR_SUCCESS) {        return status;    }    if ((status = apr_pollset_poll(ps->pollset, duration, &num,                                   &desc)) != APR_SUCCESS) {        /* EINTR indicates a handled signal happened during the poll call,           ignore, the application can safely retry. */        if (APR_STATUS_IS_EINTR(status))            return APR_SUCCESS;        /* ### do we still need to dispatch stuff here?           ### look at the potential return codes. map to our defined           ### return values? ...        */        /* Use the strict documented error for poll timeouts, to allow proper           handling of the other timeout types when returned from           serf_event_trigger */        if (APR_STATUS_IS_TIMEUP(status))            return APR_TIMEUP; /* Return the documented error */        return status;    }    while (num--) {        serf_io_baton_t *io  = desc->client_data;        status = serf_event_trigger(ctx, io, desc);        if (status) {            /* Don't return APR_TIMEUP as a connection error, as our caller               will use that as a trigger to call us again */            if (APR_STATUS_IS_TIMEUP(status))                status = SERF_ERROR_CONNECTION_TIMEDOUT;            return status;        }        desc++;    }    return APR_SUCCESS;}
开发者ID:KyleSanderson,项目名称:serf,代码行数:51,


示例2: multi_event_pollset

static void multi_event_pollset(abts_case *tc, void *data){    apr_status_t rv;    apr_pollfd_t socket_pollfd;    int lrv;    const apr_pollfd_t *descs = NULL;    ABTS_PTR_NOTNULL(tc, s[0]);    socket_pollfd.desc_type = APR_POLL_SOCKET;    socket_pollfd.reqevents = APR_POLLIN | APR_POLLOUT;    socket_pollfd.desc.s = s[0];    socket_pollfd.client_data = s[0];    rv = apr_pollset_add(pollset, &socket_pollfd);    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);    send_msg(s, sa, 0, tc);    rv = apr_pollset_poll(pollset, 0, &lrv, &descs);    ABTS_INT_EQUAL(tc, 0, APR_STATUS_IS_TIMEUP(rv));    if (lrv == 1) {        ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);        ABTS_INT_EQUAL(tc, APR_POLLIN | APR_POLLOUT, descs[0].rtnevents);        ABTS_PTR_EQUAL(tc, s[0],  descs[0].client_data);    }    else if (lrv == 2) {        ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);        ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data);        ABTS_PTR_EQUAL(tc, s[0], descs[1].desc.s);        ABTS_PTR_EQUAL(tc, s[0], descs[1].client_data);        ABTS_ASSERT(tc, "returned events incorrect",                    ((descs[0].rtnevents | descs[1].rtnevents)                     == (APR_POLLIN | APR_POLLOUT))                    && descs[0].rtnevents != descs[1].rtnevents);    }    else {        ABTS_ASSERT(tc, "either one or two events returned",                    lrv == 1 || lrv == 2);    }    recv_msg(s, 0, p, tc);    rv = apr_pollset_poll(pollset, 0, &lrv, &descs);    ABTS_INT_EQUAL(tc, 0, APR_STATUS_IS_TIMEUP(rv));    ABTS_INT_EQUAL(tc, 1, lrv);    ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);    ABTS_INT_EQUAL(tc, APR_POLLOUT, descs[0].rtnevents);    ABTS_PTR_EQUAL(tc, s[0],  descs[0].client_data);    rv = apr_pollset_remove(pollset, &socket_pollfd);    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);}
开发者ID:KunZheng,项目名称:mosbench,代码行数:51,


示例3: timeout_pollin_pollcb

static void timeout_pollin_pollcb(abts_case *tc, void *data){    apr_status_t rv;    pollcb_baton_t pcb;    apr_pollfd_t socket_pollfd;    POLLCB_PREREQ;    recv_msg(s, 0, p, tc);        ABTS_PTR_NOTNULL(tc, s[0]);    socket_pollfd.desc_type = APR_POLL_SOCKET;    socket_pollfd.reqevents = APR_POLLIN;    socket_pollfd.desc.s = s[0];    socket_pollfd.client_data = s[0];    rv = apr_pollcb_add(pollcb, &socket_pollfd);    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);        pcb.count = 0;    pcb.tc = tc;        rv = apr_pollcb_poll(pollcb, 1, trigger_pollcb_cb, &pcb);        ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));    ABTS_INT_EQUAL(tc, 0, pcb.count);    rv = apr_pollcb_remove(pollcb, &socket_pollfd);    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);}
开发者ID:Ga-vin,项目名称:apache,代码行数:28,


示例4: procmgr_fetch_cmd

apr_status_t procmgr_fetch_cmd(fcgid_command * command,                              server_rec * main_server){    apr_status_t rv;    /* Sanity check */    if (!g_pm_read_pipe)        return APR_EPIPE;    /* Wait for next command */#if APR_MAJOR_VERSION < 2    rv = apr_wait_for_io_or_timeout(g_pm_read_pipe, NULL, FOR_READ);#else    rv = apr_file_pipe_wait(g_pm_read_pipe, APR_WAIT_READ);#endif    /* Log any unexpect result */    if (rv != APR_SUCCESS && !APR_STATUS_IS_TIMEUP(rv)) {        ap_log_error(APLOG_MARK, APLOG_WARNING, rv, main_server,                     "mod_fcgid: error while waiting for message from pipe");        return rv;    }    /* Timeout */    if (rv != APR_SUCCESS)        return rv;    return apr_file_read_full(g_pm_read_pipe, command, sizeof(*command),                              NULL);}
开发者ID:famzah,项目名称:mod_fcgid,代码行数:30,


示例5: test_timeout

static void test_timeout(abts_case *tc, apr_reslist_t *rl){    apr_status_t rv;    my_resource_t *resources[RESLIST_HMAX];    my_resource_t *res;    void *vp;    int i;    apr_reslist_timeout_set(rl, 1000);    /* deplete all possible resources from the resource list     * so that the next call will block until timeout is reached     * (since there are no other threads to make a resource     * available)     */    for (i = 0; i < RESLIST_HMAX; i++) {        rv = apr_reslist_acquire(rl, (void**)&resources[i]);        ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);    }    /* next call will block until timeout is reached */    rv = apr_reslist_acquire(rl, &vp);    ABTS_TRUE(tc, APR_STATUS_IS_TIMEUP(rv));    res = vp;    /* release the resources; otherwise the destroy operation     * will blow     */    for (i = 0; i < RESLIST_HMAX; i++) {        rv = apr_reslist_release(rl, resources[i]);        ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);    }}
开发者ID:QsBBQ,项目名称:masspinger,代码行数:35,


示例6: read_pipe

// Called by parent process.static std::string read_pipe(apr_file_t* in, bool timeout_ok = false){	char buf[256];	unsigned char bytes_to_read;	apr_size_t bytes_read;	apr_status_t status = apr_file_read_full(in, &bytes_to_read, 1, &bytes_read);	if (status != APR_SUCCESS)	{		if (APR_STATUS_IS_TIMEUP(status) && timeout_ok)		{			return "TIMEOUT";		}		llwarns << "apr_file_read_full: " << apr_strerror(status, buf, sizeof(buf)) << llendl;		assert(APR_STATUS_IS_EOF(status));		return "END OF FILE";	}	assert(bytes_read == 1);	status = apr_file_read_full(in, buf, bytes_to_read, &bytes_read);	if (status != APR_SUCCESS)	{		llwarns << "apr_file_read_full: " << apr_strerror(status, buf, sizeof(buf)) << llendl;		assert(status == APR_SUCCESS);	// Fail	}	assert(bytes_read == bytes_to_read);	std::string received(buf, bytes_read);	llinfos << "Received: /"" << received << "/" (bytes read: " << bytes_read << ")" << llendl;	return received;}
开发者ID:1234-,项目名称:SingularityViewer,代码行数:30,


示例7: bif_poll_ports1

term_t bif_poll_ports1(term_t Time, process_t *ctx){	//apr_time_t t1, t2;	apr_status_t rs;	apr_interval_time_t micros;	if (!is_int(Time))		return A_BADARG;	micros = int_value(Time);	//if (micros != 0)	//	printf("ports_poll for %ld/n", micros);	// XXX	//t1 = apr_time_now();	rs = ports_poll(micros);	//t2 = apr_time_now();	//if (t2 - t1 < micros)	//	printf("ports_poll slept for less then requested: %ld instead of %ld/n",	//		t2 - t1, micros);	if (rs && !APR_STATUS_IS_TIMEUP(rs))		return decipher_status(rs);	result(A_TRUE);	return AI_OK;}
开发者ID:aidanhs,项目名称:teeterl,代码行数:30,


示例8: dynamic_binding

static void dynamic_binding(abts_case *tc, void *data){    unsigned int i;    apr_status_t rv;    toolbox_t box[NTHREADS];    apr_thread_t *thread[NTHREADS];    apr_thread_mutex_t *mutex[NTHREADS];    apr_thread_cond_t *cond = NULL;    rv = apr_thread_cond_create(&cond, p);    ABTS_SUCCESS(rv);    ABTS_PTR_NOTNULL(tc, cond);    for (i = 0; i < NTHREADS; i++) {        rv = apr_thread_mutex_create(&mutex[i], APR_THREAD_MUTEX_DEFAULT, p);        ABTS_SUCCESS(rv);        rv = apr_thread_mutex_lock(mutex[i]);        ABTS_SUCCESS(rv);        box[i].tc = tc;        box[i].cond = cond;        box[i].mutex = mutex[i];        box[i].func = lock_and_signal;        rv = apr_thread_create(&thread[i], NULL, thread_routine, &box[i], p);        ABTS_SUCCESS(rv);    }    /*     * The dynamic binding should be preserved because we use only one waiter     */    for (i = 0; i < NTHREADS; i++) {        rv = apr_thread_cond_wait(cond, mutex[i]);        ABTS_SUCCESS(rv);    }    for (i = 0; i < NTHREADS; i++) {        rv = apr_thread_cond_timedwait(cond, mutex[i], 10000);        ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));        rv = apr_thread_mutex_unlock(mutex[i]);        ABTS_SUCCESS(rv);    }    for (i = 0; i < NTHREADS; i++) {        apr_status_t retval;        rv = apr_thread_join(&retval, thread[i]);        ABTS_SUCCESS(rv);    }    rv = apr_thread_cond_destroy(cond);    ABTS_SUCCESS(rv);    for (i = 0; i < NTHREADS; i++) {        rv = apr_thread_mutex_destroy(mutex[i]);        ABTS_SUCCESS(rv);    }}
开发者ID:ohmann,项目名称:checkapi,代码行数:60,


示例9: main

int main(int argc, char *argv[]){    apr_pool_t *p;    apr_socket_t *sock;    apr_status_t rv;    apr_sockaddr_t *remote_sa;    apr_initialize();    atexit(apr_terminate);    apr_pool_create(&p, NULL);    if (argc < 2) {        exit(-1);    }    rv = apr_sockaddr_info_get(&remote_sa, "127.0.0.1", APR_UNSPEC, 8021, 0, p);    if (rv != APR_SUCCESS) {        exit(-1);    }    if (apr_socket_create(&sock, remote_sa->family, SOCK_STREAM, 0,                          p) != APR_SUCCESS) {        exit(-1);    }    rv = apr_socket_timeout_set(sock, apr_time_from_sec(3));    if (rv) {        exit(-1);    }    apr_socket_connect(sock, remote_sa);    if (!strcmp("read", argv[1])) {        char datarecv[STRLEN];        apr_size_t length = STRLEN;        apr_status_t rv;        memset(datarecv, 0, STRLEN);        rv = apr_socket_recv(sock, datarecv, &length);        apr_socket_close(sock);        if (APR_STATUS_IS_TIMEUP(rv)) {            exit(SOCKET_TIMEOUT);        }        if (strcmp(datarecv, DATASTR)) {            exit(-1);        }        exit((int)length);    }    else if (!strcmp("write", argv[1])) {        apr_size_t length = strlen(DATASTR);        apr_socket_send(sock, DATASTR, &length);        apr_socket_close(sock);        exit((int)length);    }    exit(-1);}
开发者ID:Bernd8,项目名称:quantlib,代码行数:59,


示例10: lost_signal

static void lost_signal(abts_case *tc, void *data){    apr_status_t rv;    apr_thread_cond_t *cond = NULL;    apr_thread_mutex_t *mutex = NULL;    rv = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, p);    ABTS_SUCCESS(rv);    ABTS_PTR_NOTNULL(tc, mutex);    rv = apr_thread_cond_create(&cond, p);    ABTS_SUCCESS(rv);    ABTS_PTR_NOTNULL(tc, cond);    rv = apr_thread_cond_signal(cond);    ABTS_SUCCESS(rv);    rv = apr_thread_mutex_lock(mutex);    ABTS_SUCCESS(rv);    rv = apr_thread_cond_timedwait(cond, mutex, 10000);    ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));    rv = apr_thread_mutex_unlock(mutex);    ABTS_SUCCESS(rv);    rv = apr_thread_cond_broadcast(cond);    ABTS_SUCCESS(rv);    rv = apr_thread_mutex_lock(mutex);    ABTS_SUCCESS(rv);    rv = apr_thread_cond_timedwait(cond, mutex, 10000);    ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));    rv = apr_thread_mutex_unlock(mutex);    ABTS_SUCCESS(rv);    rv = apr_thread_cond_destroy(cond);    ABTS_SUCCESS(rv);    rv = apr_thread_mutex_destroy(mutex);    ABTS_SUCCESS(rv);}
开发者ID:ohmann,项目名称:checkapi,代码行数:44,


示例11: test_helper_run_requests_no_check

/* Helper function, runs the client and server context loops and validates that no errors were encountered, and all messages were sent and received. */apr_status_ttest_helper_run_requests_no_check(CuTest *tc, test_baton_t *tb,                                  int num_requests,                                  handler_baton_t handler_ctx[],                                  apr_pool_t *pool){    apr_pool_t *iter_pool;    int i, done = 0;    apr_status_t status;    apr_pool_create(&iter_pool, pool);    while (!done)    {        apr_pool_clear(iter_pool);        /* run server event loop */        status = run_test_server(tb->serv_ctx, 0, iter_pool);        if (!APR_STATUS_IS_TIMEUP(status) &&            SERF_BUCKET_READ_ERROR(status))            return status;        /* run proxy event loop */        if (tb->proxy_ctx) {            status = run_test_server(tb->proxy_ctx, 0, iter_pool);            if (!APR_STATUS_IS_TIMEUP(status) &&                SERF_BUCKET_READ_ERROR(status))                return status;        }        /* run client event loop */        status = serf_context_run(tb->context, 0, iter_pool);        if (!APR_STATUS_IS_TIMEUP(status) &&            SERF_BUCKET_READ_ERROR(status))            return status;        done = 1;        for (i = 0; i < num_requests; i++)            done &= handler_ctx[i].done;    }    apr_pool_destroy(iter_pool);    return APR_SUCCESS;}
开发者ID:gunjanms,项目名称:svnmigration,代码行数:46,


示例12: cgi_bucket_read

/* Read method of CGI bucket: polls on stderr and stdout of the child, * sending any stderr output immediately away to the error log. */static apr_status_t cgi_bucket_read(apr_bucket *b, const char **str,                                    apr_size_t *len, apr_read_type_e block){    struct cgi_bucket_data *data = b->data;    apr_interval_time_t timeout;    apr_status_t rv;    int gotdata = 0;    timeout = block == APR_NONBLOCK_READ ? 0 : data->r->server->timeout;    do {        const apr_pollfd_t *results;        apr_int32_t num;        rv = apr_pollset_poll(data->pollset, timeout, &num, &results);        if (APR_STATUS_IS_TIMEUP(rv)) {            if (timeout) {                ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, data->r,                              "Timeout waiting for output from CGI script %s",                              data->r->filename);                return rv;            }            else {                return APR_EAGAIN;            }        }        else if (APR_STATUS_IS_EINTR(rv)) {            continue;        }        else if (rv != APR_SUCCESS) {            ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, data->r,                          "poll failed waiting for CGI child");            return rv;        }        for (; num; num--, results++) {            if (results[0].client_data == (void *)1) {                /* stdout */                rv = cgi_read_stdout(b, results[0].desc.f, str, len);                if (APR_STATUS_IS_EOF(rv)) {                    rv = APR_SUCCESS;                }                gotdata = 1;            } else {                /* stderr */                apr_status_t rv2 = log_script_err(data->r, results[0].desc.f);                if (APR_STATUS_IS_EOF(rv2)) {                    apr_pollset_remove(data->pollset, &results[0]);                }            }        }    } while (!gotdata);    return rv;}
开发者ID:daisukeokaoss,项目名称:ExpandProjectIntoOneFile,代码行数:58,


示例13: nomessage_pollset

static void nomessage_pollset(CuTest *tc){    apr_status_t rv;    int lrv;    const apr_pollfd_t *descs = NULL;    rv = apr_pollset_poll(pollset, 0, &lrv, &descs);    CuAssertIntEquals(tc, 1, APR_STATUS_IS_TIMEUP(rv));    CuAssertIntEquals(tc, 0, lrv);    CuAssertPtrEquals(tc, NULL, descs);}
开发者ID:kheradmand,项目名称:Break,代码行数:11,


示例14: nomessage

static void nomessage(CuTest *tc){    apr_status_t rv;    int srv = SMALL_NUM_SOCKETS;    rv = apr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC);    CuAssertIntEquals(tc, 1, APR_STATUS_IS_TIMEUP(rv));    check_sockets(pollarray, s, 0, 0, tc);    check_sockets(pollarray, s, 1, 0, tc);    check_sockets(pollarray, s, 2, 0, tc);}
开发者ID:kheradmand,项目名称:Break,代码行数:11,


示例15: APR_DECLARE

APR_DECLARE(apr_status_t) apr_socket_atreadeof(apr_socket_t *sock, int *atreadeof){    apr_pollfd_t pfds[1];    apr_status_t rv;    apr_int32_t  nfds;    /* The purpose here is to return APR_SUCCESS only in cases in     * which it can be unambiguously determined whether or not the     * socket will return EOF on next read.  In case of an unexpected     * error, return that. */    pfds[0].reqevents = APR_POLLIN;    pfds[0].desc_type = APR_POLL_SOCKET;    pfds[0].desc.s = sock;    do {        rv = apr_poll(&pfds[0], 1, &nfds, 0);    } while (APR_STATUS_IS_EINTR(rv));    if (APR_STATUS_IS_TIMEUP(rv)) {        /* Read buffer empty -> subsequent reads would block, so,         * definitely not at EOF. */        *atreadeof = 0;        return APR_SUCCESS;    }    else if (rv) {        /* Some other error -> unexpected error. */        return rv;    }    else if (nfds == 1 && pfds[0].rtnevents == APR_POLLIN) {        apr_sockaddr_t unused;        apr_size_t len = 1;        char buf;        /* The socket is readable - peek to see whether it returns EOF         * without consuming bytes from the socket buffer. */        rv = apr_socket_recvfrom(&unused, sock, MSG_PEEK, &buf, &len);        if (rv == APR_EOF) {            *atreadeof = 1;            return APR_SUCCESS;        }        else if (rv) {            /* Read error -> unexpected error. */            return rv;        }        else {            *atreadeof = 0;            return APR_SUCCESS;        }    }    /* Should not fall through here. */    return APR_EGENERAL;}
开发者ID:321543223,项目名称:kbengine,代码行数:54,


示例16: nomessage

static void nomessage(abts_case *tc, void *data){    apr_status_t rv;    int srv = SMALL_NUM_SOCKETS;    rv = apr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC);    ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));    check_sockets(pollarray, s, 0, 0, tc);    check_sockets(pollarray, s, 1, 0, tc);    check_sockets(pollarray, s, 2, 0, tc);}
开发者ID:Ga-vin,项目名称:apache,代码行数:11,


示例17: nomessage_pollset

static void nomessage_pollset(abts_case *tc, void *data){    apr_status_t rv;    int lrv;    const apr_pollfd_t *descs = NULL;    rv = apr_pollset_poll(pollset, 0, &lrv, &descs);    ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));    ABTS_INT_EQUAL(tc, 0, lrv);    ABTS_PTR_EQUAL(tc, NULL, descs);}
开发者ID:Ga-vin,项目名称:apache,代码行数:11,


示例18: clear_last_pollset

static void clear_last_pollset(abts_case *tc, void *data){    apr_status_t rv;    int lrv;    const apr_pollfd_t *descs = NULL;    recv_msg(s, LARGE_NUM_SOCKETS - 1, p, tc);    rv = apr_pollset_poll(pollset, 0, &lrv, &descs);    ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));    ABTS_INT_EQUAL(tc, 0, lrv);    ABTS_PTR_EQUAL(tc, NULL, descs);}
开发者ID:Ga-vin,项目名称:apache,代码行数:13,


示例19: clear_last_pollset

static void clear_last_pollset(CuTest *tc){    apr_status_t rv;    int lrv;    const apr_pollfd_t *descs = NULL;    recv_msg(s, LARGE_NUM_SOCKETS - 1, p, tc);    rv = apr_pollset_poll(pollset, 0, &lrv, &descs);    CuAssertIntEquals(tc, 1, APR_STATUS_IS_TIMEUP(rv));    CuAssertIntEquals(tc, 0, lrv);    CuAssertPtrEquals(tc, NULL, descs);}
开发者ID:kheradmand,项目名称:Break,代码行数:13,


示例20: timeout_pollcb

static void timeout_pollcb(abts_case *tc, void *data){    apr_status_t rv;    pollcb_baton_t pcb;    POLLCB_PREREQ;    pcb.count = 0;    pcb.tc = tc;    rv = apr_pollcb_poll(pollcb, 1, trigger_pollcb_cb, &pcb);        ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));    ABTS_INT_EQUAL(tc, 0, pcb.count);}
开发者ID:Ga-vin,项目名称:apache,代码行数:14,


示例21: clear_all_signalled

static void clear_all_signalled(abts_case *tc, void *data){    apr_status_t rv;    int srv = SMALL_NUM_SOCKETS;    recv_msg(s, 0, p, tc);    recv_msg(s, 2, p, tc);    rv = apr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC);    ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));    check_sockets(pollarray, s, 0, 0, tc);    check_sockets(pollarray, s, 1, 0, tc);    check_sockets(pollarray, s, 2, 0, tc);}
开发者ID:Ga-vin,项目名称:apache,代码行数:14,


示例22: clear_all_signalled

static void clear_all_signalled(CuTest *tc){    apr_status_t rv;    int srv = SMALL_NUM_SOCKETS;    recv_msg(s, 0, p, tc);    recv_msg(s, 2, p, tc);    rv = apr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC);    CuAssertIntEquals(tc, 1, APR_STATUS_IS_TIMEUP(rv));    check_sockets(pollarray, s, 0, 0, tc);    check_sockets(pollarray, s, 1, 0, tc);    check_sockets(pollarray, s, 2, 0, tc);}
开发者ID:kheradmand,项目名称:Break,代码行数:14,


示例23: h2_mplx_release_and_join

apr_status_t h2_mplx_release_and_join(h2_mplx *m, apr_thread_cond_t *wait){    apr_status_t status;    int acquired;    h2_workers_unregister(m->workers, m);    if ((status = enter_mutex(m, &acquired)) == APR_SUCCESS) {        int i, wait_secs = 5;                /* disable WINDOW_UPDATE callbacks */        h2_mplx_set_consumed_cb(m, NULL, NULL);                while (!h2_io_set_iter(m->stream_ios, stream_done_iter, m)) {            /* iterate until all ios have been orphaned or destroyed */        }            /* Any remaining ios have handed out requests to workers that are         * not done yet. Any operation they do on their assigned stream ios will         * be errored ECONNRESET/ABORTED, so that should find out pretty soon.         */        for (i = 0; h2_io_set_size(m->stream_ios) > 0; ++i) {            m->join_wait = wait;            ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, m->c,                          "h2_mplx(%ld): release_join, waiting on %d worker to report back",                           m->id, (int)h2_io_set_size(m->stream_ios));                                      status = apr_thread_cond_timedwait(wait, m->lock, apr_time_from_sec(wait_secs));            if (APR_STATUS_IS_TIMEUP(status)) {                if (i > 0) {                    /* Oh, oh. Still we wait for assigned  workers to report that                      * they are done. Unless we have a bug, a worker seems to be hanging.                      * If we exit now, all will be deallocated and the worker, once                      * it does return, will walk all over freed memory...                     */                    ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, m->c,                                  "h2_mplx(%ld): release, waiting for %d seconds now for "                                  "all h2_workers to return, have still %d requests outstanding",                                   m->id, i*wait_secs, (int)h2_io_set_size(m->stream_ios));                }            }        }        ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, m->c,                      "h2_mplx(%ld): release_join -> destroy", m->id);        leave_mutex(m, acquired);        h2_mplx_destroy(m);        /* all gone */    }    return status;}
开发者ID:Sp1l,项目名称:mod_h2,代码行数:49,


示例24: test_timeoutcond

static void test_timeoutcond(abts_case *tc, void *data){    apr_status_t s;    apr_interval_time_t timeout;    apr_time_t begin, end;    int i;    s = apr_thread_mutex_create(&timeout_mutex, APR_THREAD_MUTEX_DEFAULT, p);    ABTS_INT_EQUAL(tc, APR_SUCCESS, s);    ABTS_PTR_NOTNULL(tc, timeout_mutex);    s = apr_thread_cond_create(&timeout_cond, p);    ABTS_INT_EQUAL(tc, APR_SUCCESS, s);    ABTS_PTR_NOTNULL(tc, timeout_cond);    timeout = apr_time_from_sec(5);    for (i = 0; i < MAX_RETRY; i++) {        apr_thread_mutex_lock(timeout_mutex);        begin = apr_time_now();        s = apr_thread_cond_timedwait(timeout_cond, timeout_mutex, timeout);        end = apr_time_now();        apr_thread_mutex_unlock(timeout_mutex);                if (s != APR_SUCCESS && !APR_STATUS_IS_TIMEUP(s)) {            continue;        }        ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(s));        ABTS_ASSERT(tc, "Timer returned too late", end - begin - timeout < 500000);        break;    }    ABTS_ASSERT(tc, "Too many retries", i < MAX_RETRY);    APR_ASSERT_SUCCESS(tc, "Unable to destroy the conditional",                       apr_thread_cond_destroy(timeout_cond));}
开发者ID:skizhak,项目名称:open-media-flow-controller,代码行数:36,


示例25: r_wait_space

static apr_status_t r_wait_space(h2_bucket_beam *beam, apr_read_type_e block,                                 h2_beam_lock *pbl, apr_off_t *premain) {    *premain = calc_space_left(beam);    while (!beam->aborted && *premain <= 0            && (block == APR_BLOCK_READ) && pbl->mutex) {        apr_status_t status = wait_cond(beam, pbl->mutex);        if (APR_STATUS_IS_TIMEUP(status)) {            return status;        }        r_purge_reds(beam);        *premain = calc_space_left(beam);    }    return beam->aborted? APR_ECONNABORTED : APR_SUCCESS;}
开发者ID:yewang15215,项目名称:mod_h2,代码行数:15,


示例26: recv_large_pollarray

static void recv_large_pollarray(abts_case *tc, void *data){    apr_status_t rv;    int lrv = LARGE_NUM_SOCKETS;    int i;    recv_msg(s, LARGE_NUM_SOCKETS - 1, p, tc);    rv = apr_poll(pollarray_large, LARGE_NUM_SOCKETS, &lrv,                   2 * APR_USEC_PER_SEC);    ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));    for (i = 0; i < LARGE_NUM_SOCKETS; i++) {        check_sockets(pollarray_large, s, i, 0, tc);    }}
开发者ID:Ga-vin,项目名称:apache,代码行数:16,


示例27: recv_large_pollarray

static void recv_large_pollarray(CuTest *tc){    apr_status_t rv;    int lrv = LARGE_NUM_SOCKETS;    int i;    recv_msg(s, LARGE_NUM_SOCKETS - 1, p, tc);    rv = apr_poll(pollarray_large, LARGE_NUM_SOCKETS, &lrv,                   2 * APR_USEC_PER_SEC);    CuAssertIntEquals(tc, 1, APR_STATUS_IS_TIMEUP(rv));    for (i = 0; i < LARGE_NUM_SOCKETS; i++) {        check_sockets(pollarray_large, s, i, 0, tc);    }}
开发者ID:kheradmand,项目名称:Break,代码行数:16,


示例28: run_client_and_mock_servers_loops

apr_status_trun_client_and_mock_servers_loops(test_baton_t *tb,                                  int num_requests,                                  handler_baton_t handler_ctx[],                                  apr_pool_t *pool){    apr_pool_t *iter_pool;    int i, done = 0;    MockHTTP *mh = tb->mh;    apr_status_t status;    apr_time_t finish_time = apr_time_now() + apr_time_from_sec(15);    apr_pool_create(&iter_pool, pool);    while (!done)    {        mhError_t err;        apr_pool_clear(iter_pool);        /* run server event loop */        err = mhRunServerLoop(mh);        /* Even if the mock server returned an error, it may have written            something to the client. So process that data first, handle the error           later. */        /* run client event loop */        status = serf_context_run(tb->context, 0, iter_pool);        if (!APR_STATUS_IS_TIMEUP(status) &&            SERF_BUCKET_READ_ERROR(status))            return status;        done = 1;        for (i = 0; i < num_requests; i++)            done &= handler_ctx[i].done;        if (!done && (apr_time_now() > finish_time))            return APR_ETIMEDOUT;        if (err == MOCKHTTP_TEST_FAILED)            return SERF_ERROR_ISSUE_IN_TESTSUITE;    }    apr_pool_destroy(iter_pool);        return APR_SUCCESS;}
开发者ID:KyleSanderson,项目名称:serf,代码行数:46,


示例29: getsfunc_BRIGADE

static int getsfunc_BRIGADE(char *buf, int len, void *arg){    apr_bucket_brigade *bb = (apr_bucket_brigade *)arg;    const char *dst_end = buf + len - 1; /* leave room for terminating null */    char *dst = buf;    apr_bucket *e = APR_BRIGADE_FIRST(bb);    apr_status_t rv;    int done = 0;    while ((dst < dst_end) && !done && e != APR_BRIGADE_SENTINEL(bb)           && !APR_BUCKET_IS_EOS(e)) {        const char *bucket_data;        apr_size_t bucket_data_len;        const char *src;        const char *src_end;        apr_bucket * next;        rv = apr_bucket_read(e, &bucket_data, &bucket_data_len,                             APR_BLOCK_READ);        if (rv != APR_SUCCESS || (bucket_data_len == 0)) {            *dst = '/0';            return APR_STATUS_IS_TIMEUP(rv) ? -1 : 0;        }        src = bucket_data;        src_end = bucket_data + bucket_data_len;        while ((src < src_end) && (dst < dst_end) && !done) {            if (*src == '/n') {                done = 1;            }            else if (*src != '/r') {                *dst++ = *src;            }            src++;        }        if (src < src_end) {            apr_bucket_split(e, src - bucket_data);        }        next = APR_BUCKET_NEXT(e);        apr_bucket_delete(e);        e = next;    }    *dst = 0;    return done;}
开发者ID:MichealYangGitHub,项目名称:C,代码行数:45,


示例30: php_apache_sapi_read_post

static apr_size_tphp_apache_sapi_read_post(char *buf, size_t count_bytes){	apr_size_t len, tlen=0;	php_struct *ctx = SG(server_context);	request_rec *r;	apr_bucket_brigade *brigade;	apr_status_t ret;	r = ctx->r;	brigade = ctx->brigade;	len = count_bytes;	/*	 * This loop is needed because ap_get_brigade() can return us partial data	 * which would cause premature termination of request read. Therefor we	 * need to make sure that if data is available we fill the buffer completely.	 */	while ((ret=ap_get_brigade(r->input_filters, brigade, AP_MODE_READBYTES, APR_BLOCK_READ, len)) == APR_SUCCESS) {		apr_brigade_flatten(brigade, buf, &len);		apr_brigade_cleanup(brigade);		tlen += len;		if (tlen == count_bytes || !len) {			break;		}		buf += len;		len = count_bytes - tlen;	}	if (ret != APR_SUCCESS) {		if (APR_STATUS_IS_TIMEUP(ret)) {			SG(sapi_headers).http_response_code = php_ap_map_http_request_error(ret, HTTP_REQUEST_TIME_OUT);		} else {			SG(sapi_headers).http_response_code = php_ap_map_http_request_error(ret, HTTP_BAD_REQUEST);		}	}	return tlen;}
开发者ID:Synchro,项目名称:php-src,代码行数:40,



注:本文中的APR_STATUS_IS_TIMEUP函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ APUSetZN8函数代码示例
C++ APR_STATUS_IS_EOF函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。