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

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

51自学网 2021-06-03 08:45:15
  C++
这篇教程C++ test_close函数代码示例写得很实用,希望能帮到您。

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

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

示例1: main

int main() {    MBED_HOSTTEST_TIMEOUT(20);    MBED_HOSTTEST_SELECT(default_auto);    MBED_HOSTTEST_DESCRIPTION(Semihost file system);    MBED_HOSTTEST_START("MBED_A2");    pc.printf("Test the Stream class/n");    printf("connected: %s/n", (semihost_connected()) ? ("Yes") : ("No"));    char mac[16];    mbed_mac_address(mac);    printf("mac address: %02x,%02x,%02x,%02x,%02x,%02x/n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);    LocalFileSystem local("local");    FILE *f;    char *str = TEST_STRING;    char *buffer = (char *)malloc(sizeof(unsigned char) * strlen(TEST_STRING));    int str_len = strlen(TEST_STRING);    // Write    f = test_open("w");    test_write(f, str, str_len);    test_close(f);    // Read    f = test_open("r");    test_read(f, buffer, str_len);    test_close(f);    // Check the two strings are equal    MBED_HOSTTEST_RESULT((strncmp(buffer, str, str_len) == 0));}
开发者ID:1deus,项目名称:tmk_keyboard,代码行数:34,


示例2: main

int main() {    pc.printf("Test the Stream class/n");        printf("connected: %s/n", (semihost_connected()) ? ("Yes") : ("No"));        char mac[16];    mbed_mac_address(mac);     printf("mac address: %02x,%02x,%02x,%02x,%02x,%02x/n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);         LocalFileSystem local("local");        FILE *f;    char* str = TEST_STRING;    char* buffer = (char*) malloc(sizeof(unsigned char)*strlen(TEST_STRING));    int str_len = strlen(TEST_STRING);        // Write    f = test_open("w");    test_write(f, str, str_len);    test_close(f);        // Read    f = test_open("r");    test_read(f, buffer, str_len);    test_close(f);        // Check the two strings are equal    notify_completion((strncmp(buffer, str, str_len) == 0));}
开发者ID:3eggert,项目名称:mbed,代码行数:29,


示例3: setup_interleaved

static void setup_interleaved(void) {    JournalFile *one, *two;    one = test_open("one.journal");    two = test_open("two.journal");    append_number(one, 1, NULL);    append_number(two, 2, NULL);    append_number(one, 3, NULL);    append_number(two, 4, NULL);    test_close(one);    test_close(two);}
开发者ID:samveen,项目名称:uselessd,代码行数:11,


示例4: run_close_test

int run_close_test(void * f, int expected_errno, const char * condition){	int err;	printf("testing close()...");	printf("%s", condition);	printf("...");	err = test_close(f);	if ( err < 0 ){		if ( expected_errno == 0 ){			fflush(stdout);			perror("unexpected error");			return -1;		} else if ( errno == expected_errno ){			printf("passed/n");			return -1;		}	} else {		if ( expected_errno == 0 ){			printf("passed/n");			return 0;		} else {			printf("should have failed with %d/n", expected_errno);			return 0;		}	}	return -1;}
开发者ID:StratifyLabs,项目名称:StratifyOS,代码行数:28,


示例5: testdomain

int testdomain(){    int rc;    int s;    int op;    size_t opsz;    printf("test domain/n");    s = test_socket (AF_SP, NN_PAIR);    opsz = sizeof (op);    rc = nn_getsockopt (s, NN_SOL_SOCKET, NN_DOMAIN, &op, &opsz);    errno_assert (rc == 0);    nn_assert (opsz == sizeof (op));    nn_assert (op == AF_SP);    opsz = sizeof (op);    rc = nn_getsockopt (s, NN_SOL_SOCKET, NN_PROTOCOL, &op, &opsz);    errno_assert (rc == 0);    nn_assert (opsz == sizeof (op));    nn_assert (op == NN_PAIR);    test_close (s);    return 0;}
开发者ID:Miyurz,项目名称:SuperNET,代码行数:26,


示例6: testterm

int testterm(){    int rc;    int s;    struct nn_thread thread;    printf("test term/n");    /*  Close the socket with no associated endpoints. */    s = test_socket (AF_SP, NN_PAIR);    test_close (s);    /*  Test nn_term() before nn_close(). */    nn_thread_init (&thread, worker, NULL);    nn_sleep (100);    nn_term();    /*  Check that it's not possible to create new sockets after nn_term(). */    rc = nn_socket (AF_SP, NN_PAIR);    nn_assert (rc == -1);    errno_assert (nn_errno () == ETERM);    /*  Wait till worker thread terminates. */    nn_thread_term(&thread);    printf("nn_thread_term finished/n");    return 0;}
开发者ID:Tosch110,项目名称:SuperNET_API,代码行数:26,


示例7: DEF_TEST

DEF_TEST(document_tests, reporter) {    test_empty(reporter);    test_abort(reporter);    test_abortWithFile(reporter);    test_file(reporter);    test_close(reporter);}
开发者ID:Adenilson,项目名称:skia,代码行数:7,


示例8: main

int main(){    int err;    Plfs_fd *fd = NULL;    int open_flags = O_RDONLY | O_CREAT;    /*      Have thread 0 open the file first to ensure that it is created     */    if (!MYTHREAD) {      UPC_ADIO_Open( &fd, fn, open_flags, 		     0666, &err );	    }    upc_barrier;    err = 0;        /*      Let the other threads open the file    */    if (MYTHREAD) {      UPC_ADIO_Open( &fd, fn, open_flags, 		     0666, &err );    }        upc_barrier;	    assert (fd != NULL);    test_close(fd, open_flags);    pass();}
开发者ID:hugegreenbug,项目名称:pupcio,代码行数:30,


示例9: main

void main(int argc, char *argv[]) {  test_init();  int port = atoi(argv[1]);    int sockfd = DI_init_measurer(port);  char line[256];    sprintf(line, "(set_target %s)",argv[2]);  DI_send_request(sockfd, line);  test_start(sockfd);    test_measurement(sockfd, "(measure (var /"a/"))", ME_measurement_create_string("45"));    test_measurement(sockfd, "(measure (var /"b/"))", ME_measurement_create_string("2"));  test_continue(sockfd);    test_measurement(sockfd, "(measure (var /"a/"))", ME_measurement_create_string("46"));    test_measurement(sockfd, "(measure (var /"b/"))", ME_measurement_create_string("2"));    DI_send_request(sockfd, "(quit)");  close(sockfd);    test_close();  }
开发者ID:armoredsoftware,项目名称:measurer,代码行数:29,


示例10: main

int main (){#if !defined NN_HAVE_WINDOWS    int sb;    int i;    int j;    struct nn_thread threads [THREAD_COUNT];    /*  Stress the shutdown algorithm. */    sb = test_socket (AF_SP, NN_PUB);    test_bind (sb, SOCKET_ADDRESS);    for (j = 0; j != 10; ++j) {        for (i = 0; i != THREAD_COUNT; ++i)            nn_thread_init (&threads [i], routine, NULL);        for (i = 0; i != THREAD_COUNT; ++i)            nn_thread_term (&threads [i]);    }    test_close (sb);#endif    return 0;}
开发者ID:antmd,项目名称:nanomsg,代码行数:26,


示例11: main

int main() {    SDFileSystem sd(p11, p12, p13, p14, "sd");        FILE *f;    char* str = TEST_STRING;    char* buffer = (char*) malloc(sizeof(unsigned char)*strlen(TEST_STRING));    int str_len = strlen(TEST_STRING);        printf("Write files/n");    char filename[32];    for (int i=0; i<10; i++) {        sprintf(filename, "/sd/test_%d.txt", i);        printf("Creating file: %s/n", filename);        f = test_open(filename, "w");        test_write(f, str);        test_close(f);    }        printf("List files:/n");    DIR *d = opendir("/sd");    if (d == NULL) {        printf("Error opening directory/n");        notify_completion(false);    }        struct dirent *p;    while((p = readdir(d)) != NULL) {        printf("%s/n", p->d_name);    }    closedir(d);        notify_completion(true);}
开发者ID:CNCBASHER,项目名称:mbed,代码行数:33,


示例12: main

int main (int argc, const char *argv[]){    int end0;    int end1;    struct nn_thread thread5;    struct nn_thread thread6;    int port = get_test_port(argc, argv);    test_addr_from(socket_address_h, "tcp", "127.0.0.1", port);    test_addr_from(socket_address_i, "tcp", "127.0.0.1", port + 1);    test_addr_from(socket_address_j, "tcp", "127.0.0.1", port + 2);    /*  Test the bi-directional device with REQ/REP (headers). */    /*  Start the devices. */    nn_thread_init (&thread5, device5, NULL);    nn_thread_init (&thread6, device6, NULL);    /*  Create two sockets to connect to the device. */    end0 = test_socket (AF_SP, NN_REQ);    test_connect (end0, socket_address_h);    end1 = test_socket (AF_SP, NN_REP);    test_connect (end1, socket_address_j);    /*  Wait for TCP to establish. */    nn_sleep (100);    /*  Pass a message between endpoints. */    test_send (end0, "XYZ");    test_recv (end1, "XYZ");    /*  Now send a reply. */    test_send (end1, "REPLYXYZ");    test_recv (end0, "REPLYXYZ");    /*  Clean up. */    test_close (end0);    test_close (end1);    /*  Shut down the devices. */    nn_term ();    nn_thread_term (&thread5);    nn_thread_term (&thread6);    return 0;}
开发者ID:HappySky2046,项目名称:nanomsg,代码行数:47,


示例13: testipc_shutdown

int testipc_shutdown(){    int sb;    int i;    int j;    struct nn_thread threads [THREAD_COUNT];    printf("test ipc shutdown/n");    /*  Stress the shutdown algorithm. */#if defined(SIGPIPE) && defined(SIG_IGN)	signal (SIGPIPE, SIG_IGN);#endif    sb = test_socket (AF_SP, NN_PUB);    test_bind (sb, SOCKET_ADDRESS);    for (j = 0; j != TEST_LOOPS; ++j) {        for (i = 0; i != THREAD_COUNT; ++i)            nn_thread_init (&threads [i], routine, NULL);        for (i = 0; i != THREAD_COUNT; ++i)            nn_thread_term (&threads [i]);    }    test_close (sb);    /*  Test race condition of sending message while socket shutting down  */    sb = test_socket (AF_SP, NN_PUSH);    test_bind (sb, SOCKET_ADDRESS);    for (j = 0; j != TEST_LOOPS; ++j) {        for (i = 0; i != TEST2_THREAD_COUNT; ++i)            nn_thread_init (&threads [i], routine2, NULL);        active = TEST2_THREAD_COUNT;        while ( active )        {            (void) nn_send (sb, "hello", 5, NN_DONTWAIT);        }        for (i = 0; i != TEST2_THREAD_COUNT; ++i)            nn_thread_term(&threads [i]);    }    test_close (sb);    return 0;}
开发者ID:Miyurz,项目名称:SuperNET,代码行数:47,


示例14: DEF_TEST

DEF_TEST(document_tests, reporter) {    REQUIRE_PDF_DOCUMENT(document_tests, reporter);    test_empty(reporter);    test_abort(reporter);    test_abortWithFile(reporter);    test_file(reporter);    test_close(reporter);}
开发者ID:Crawping,项目名称:chromium_extract,代码行数:8,


示例15: test_read_write

/**   @tested: open file, write file, read file, close_file*/void test_read_write() {    // open a file and get fd    int fd = test_open(first_doc);    test_write_read(fd);    int res = test_close(fd);    assert(res == fd);    test_std_rw();}
开发者ID:zzt93,项目名称:os-lab1,代码行数:11,


示例16: main

int main (){    int sb;    int i;    int j;    struct nn_thread threads [THREAD_COUNT];    /*  Stress the shutdown algorithm. */    sb = test_socket (AF_SP, NN_PUB);    test_bind (sb, SOCKET_ADDRESS);    for (j = 0; j != TEST_LOOPS; ++j) {        for (i = 0; i != THREAD_COUNT; ++i)            nn_thread_init (&threads [i], routine, NULL);        for (i = 0; i != THREAD_COUNT; ++i)            nn_thread_term (&threads [i]);    }    test_close (sb);    /*  Test race condition of sending message while socket shutting down  */    sb = test_socket (AF_SP, NN_PUSH);    test_bind (sb, SOCKET_ADDRESS);    for (j = 0; j != TEST_LOOPS; ++j) {        for (i = 0; i != TEST2_THREAD_COUNT; ++i)            nn_thread_init (&threads [i], routine2, NULL);        nn_atomic_init(&active, TEST2_THREAD_COUNT);        while (active.n) {            (void) nn_send (sb, "hello", 5, NN_DONTWAIT);        }        for (i = 0; i != TEST2_THREAD_COUNT; ++i)            nn_thread_term (&threads [i]);        nn_atomic_term(&active);    }    test_close (sb);    return 0;}
开发者ID:CPB9,项目名称:nanomsg,代码行数:44,


示例17: device6

void device6 (NN_UNUSED void *arg){    int rc;    int dev2;    int dev3;    dev2 = test_socket (AF_SP_RAW, NN_REP);    test_connect (dev2, socket_address_i);    dev3 = test_socket (AF_SP_RAW, NN_REQ);    test_bind (dev3, socket_address_j);    /*  Run the device. */    rc = nn_device (dev2, dev3);    nn_assert (rc < 0 && nn_errno () == ETERM);    /*  Clean up. */    test_close (dev2);    test_close (dev3);}
开发者ID:HappySky2046,项目名称:nanomsg,代码行数:19,


示例18: main

int main (){    int rc;    int sb;    int sc;    struct nn_iovec iov [2];    struct nn_msghdr hdr;    char buf [6];    sb = test_socket (AF_SP, NN_PAIR);    test_bind (sb, SOCKET_ADDRESS);    sc = test_socket (AF_SP, NN_PAIR);    test_connect (sc, SOCKET_ADDRESS);    iov [0].iov_base = "AB";    iov [0].iov_len = 2;    iov [1].iov_base = "CDEF";    iov [1].iov_len = 4;    memset (&hdr, 0, sizeof (hdr));    hdr.msg_iov = iov;    hdr.msg_iovlen = 2;    rc = nn_sendmsg (sc, &hdr, 0);    errno_assert (rc >= 0);    nn_assert (rc == 6);    iov [0].iov_base = buf;    iov [0].iov_len = 4;    iov [1].iov_base = buf + 4;    iov [1].iov_len = 2;    memset (&hdr, 0, sizeof (hdr));    hdr.msg_iov = iov;    hdr.msg_iovlen = 2;    rc = nn_recvmsg (sb, &hdr, 0);    errno_assert (rc >= 0);    nn_assert (rc == 6);    nn_assert (memcmp (buf, "ABCDEF", 6) == 0);    test_close (sc);    test_close (sb);    return 0;}
开发者ID:abit-me,项目名称:nng,代码行数:42,


示例19: device2

void device2 (NN_UNUSED void *arg){    int rc;    int devc;    int devd;    /*  Intialise the device sockets. */    devc = test_socket (AF_SP_RAW, NN_PULL);    test_bind (devc, SOCKET_ADDRESS_C);    devd = test_socket (AF_SP_RAW, NN_PUSH);    test_bind (devd, SOCKET_ADDRESS_D);    /*  Run the device. */    rc = nn_device (devc, devd);    nn_assert (rc < 0 && nn_errno () == ETERM);    /*  Clean up. */    test_close (devd);    test_close (devc);}
开发者ID:0xe,项目名称:nanomsg,代码行数:20,


示例20: device1

void device1 (NN_UNUSED void *arg){    int rc;    int deva;    int devb;    /*  Intialise the device sockets. */    deva = test_socket (AF_SP_RAW, NN_PAIR);    test_bind (deva, SOCKET_ADDRESS_A);    devb = test_socket (AF_SP_RAW, NN_PAIR);    test_bind (devb, SOCKET_ADDRESS_B);    /*  Run the device. */    rc = nn_device (deva, devb);    nn_assert (rc < 0 && nn_errno () == ETERM);    /*  Clean up. */    test_close (devb);    test_close (deva);}
开发者ID:0xe,项目名称:nanomsg,代码行数:20,


示例21: routine

static void routine (NN_UNUSED void *arg){    int s;    s = nn_socket (AF_SP, NN_SUB);    if (s < 0 && nn_errno () == EMFILE)        return;    errno_assert (s >= 0);    test_connect (s, SOCKET_ADDRESS);    test_close (s);}
开发者ID:panliang,项目名称:nanomsg,代码行数:11,


示例22: test_open_close

/**   @tested: open file, dup_file, dup2_file, close_file*/void test_open_close() {    int dup_fd;    int fd = test_open(first_doc);    // fd should be 4    // 0 -- stdin, 1 -- stdout, 2 -- stderr, 3 -- cwd    assert(fd == CWD + 1);    dup_fd = set_fd_msg(fd, dup_file);    assert(dup_fd == fd + 1);    int res;    res = test_dup2(fd, dup_fd + 1);    assert(res == dup_fd + 1);    // do some operations: read and write to file    // close the duplicated file descriptor    res = test_close(dup_fd);    assert(res == dup_fd);    res = test_close(dup_fd + 1);    assert(res == dup_fd + 1);    res = test_close(fd);    assert(res == fd);}
开发者ID:zzt93,项目名称:os-lab1,代码行数:23,


示例23: device5

void device5 (NN_UNUSED void *arg){    int rc;    int dev0;    int dev1;    /*  Intialise the device sockets. */    dev0 = test_socket (AF_SP_RAW, NN_REP);    test_bind (dev0, socket_address_h);    dev1 = test_socket (AF_SP_RAW, NN_REQ);    test_bind (dev1, socket_address_i);    /*  Run the device. */    rc = nn_device (dev0, dev1);    nn_assert (rc < 0 && nn_errno () == ETERM);    /*  Clean up. */    test_close (dev0);    test_close (dev1);}
开发者ID:HappySky2046,项目名称:nanomsg,代码行数:20,


示例24: main

int main (){    int end0;    int end1;    struct nn_thread thread5;    struct nn_thread thread6;    /*  Test the bi-directional device with REQ/REP (headers). */    /*  Start the devices. */    nn_thread_init (&thread5, device5, NULL);    nn_thread_init (&thread6, device6, NULL);    /*  Create two sockets to connect to the device. */    end0 = test_socket (AF_SP, NN_REQ);    test_connect (end0, SOCKET_ADDRESS_H);    end1 = test_socket (AF_SP, NN_REP);    test_connect (end1, SOCKET_ADDRESS_J);    /*  Wait for TCP to establish. */    nn_sleep (1000);    /*  Pass a message between endpoints. */    test_send (end0, "XYZ");    test_recv (end1, "XYZ");    /*  Now send a reply. */    test_send (end1, "REPLYXYZ");    test_recv (end0, "REPLYXYZ");    /*  Clean up. */    test_close (end0);    test_close (end1);    /*  Shut down the devices. */    nn_term ();    nn_thread_term (&thread5);    nn_thread_term (&thread6);    return 0;}
开发者ID:LuckGarfield,项目名称:nanomsg,代码行数:41,


示例25: main

int main (){    struct nn_thread thread;    sb = test_socket (AF_SP, NN_PAIR);    test_bind (sb, SOCKET_ADDRESS);    sc = test_socket (AF_SP, NN_PAIR);    test_connect (sc, SOCKET_ADDRESS);    nn_thread_init (&thread, worker, NULL);    test_recv (sb, "ABC");    test_recv (sb, "ABC");    nn_thread_term (&thread);    test_close (sc);    test_close (sb);    return 0;}
开发者ID:4Second2None,项目名称:nanomsg,代码行数:21,


示例26: test_text

/*  test_text() verifies that we drop messages properly when sending invalid    UTF-8, but not when we send valid data. */void test_text (){    int sb;    int sc;    int opt;    uint8_t bad[20];    /*  Negative testing... bad UTF-8 data for text. */    sb = test_socket (AF_SP, NN_PAIR);    sc = test_socket (AF_SP, NN_PAIR);    opt = NN_WS_MSG_TYPE_TEXT;    test_setsockopt (sb, NN_WS, NN_WS_MSG_TYPE, &opt, sizeof (opt));    opt = NN_WS_MSG_TYPE_TEXT;    test_setsockopt (sc, NN_WS, NN_WS_MSG_TYPE, &opt, sizeof (opt));    opt = 500;    test_setsockopt (sb, NN_SOL_SOCKET, NN_RCVTIMEO, &opt, sizeof (opt));    test_bind (sb, socket_address);    test_connect (sc, socket_address);    test_send (sc, "GOOD");    test_recv (sb, "GOOD");    /*  and the bad ... */    strcpy ((char *)bad, "BAD.");    bad[2] = (char)0xDD;    test_send (sc, (char *)bad);    /*  Make sure we dropped the frame. */    test_drop (sb, ETIMEDOUT);    test_close (sb);    test_close (sc);    return;}
开发者ID:Adellica,项目名称:nanomsg,代码行数:39,


示例27: main

int main (){    int rc;    int push;    int pull1;    int pull2;    int sndprio;    pull1 = test_socket (AF_SP, NN_PULL);    test_bind (pull1, SOCKET_ADDRESS_A);    pull2 = test_socket (AF_SP, NN_PULL);    test_bind (pull2, SOCKET_ADDRESS_B);    push = test_socket (AF_SP, NN_PUSH);    sndprio = 1;    rc = nn_setsockopt (push, NN_SOL_SOCKET, NN_SNDPRIO,        &sndprio, sizeof (sndprio));    errno_assert (rc == 0);    test_connect (push, SOCKET_ADDRESS_A);    sndprio = 2;    rc = nn_setsockopt (push, NN_SOL_SOCKET, NN_SNDPRIO,        &sndprio, sizeof (sndprio));    errno_assert (rc == 0);    test_connect (push, SOCKET_ADDRESS_B);    test_send (push, "ABC");    test_send (push, "DEF");    test_recv (pull1, "ABC");    test_recv (pull1, "DEF");    test_close (pull1);    test_close (push);    test_close (pull2);    /*  Test removing a pipe from the list. */    push = test_socket (AF_SP, NN_PUSH);    test_bind (push, SOCKET_ADDRESS_A);    pull1 = test_socket (AF_SP, NN_PULL);    test_connect (pull1, SOCKET_ADDRESS_A);    test_send (push, "ABC");    test_recv (pull1, "ABC");    test_close (pull1);    rc = nn_send (push, "ABC", 3, NN_DONTWAIT);    nn_assert (rc == -1 && nn_errno() == EAGAIN);    pull1 = test_socket (AF_SP, NN_PULL);    test_connect (pull1, SOCKET_ADDRESS_A);    test_send (push, "ABC");    test_recv (pull1, "ABC");    test_close (pull1);    test_close (push);    return 0;}
开发者ID:4Second2None,项目名称:nanomsg,代码行数:57,


示例28: test_allocmsg_reqrep

void test_allocmsg_reqrep (){    int rc;    int req;    void *p;    struct nn_iovec iov;    struct nn_msghdr hdr;    /*  Try to create an oversized message. */    p = nn_allocmsg (-1, 0);    nn_assert (!p && nn_errno () == ENOMEM);    p = nn_allocmsg (-1000, 0);    nn_assert (!p && nn_errno () == ENOMEM);    /*  Try to create a message of unknown type. */    p = nn_allocmsg (100, 333);    nn_assert (!p && nn_errno () == EINVAL);    /*  Create a socket. */    req = test_socket (AF_SP_RAW, NN_REQ);    /*  Make send fail and check whether the zero-copy buffer is left alone        rather than deallocated. */    p = nn_allocmsg (100, 0);    nn_assert (p);    rc = nn_send (req, &p, NN_MSG, NN_DONTWAIT);    nn_assert (rc < 0);    errno_assert (nn_errno () == EAGAIN);    memset (p, 0, 100);    rc = nn_freemsg (p);    errno_assert (rc == 0);    /*  Same thing with nn_sendmsg(). */    p = nn_allocmsg (100, 0);    nn_assert (p);    iov.iov_base = &p;    iov.iov_len = NN_MSG;    memset (&hdr, 0, sizeof (hdr));    hdr.msg_iov = &iov;    hdr.msg_iovlen = 1;    nn_sendmsg (req, &hdr, NN_DONTWAIT);    errno_assert (nn_errno () == EAGAIN);    memset (p, 0, 100);    rc = nn_freemsg (p);    errno_assert (rc == 0);    /*  Clean up. */    test_close (req);}
开发者ID:prenaux,项目名称:nanomsg,代码行数:49,


示例29: device3

void device3 (NN_UNUSED void *arg){    int rc;    int deve;    /*  Intialise the device socket. */    deve = test_socket (AF_SP_RAW, NN_BUS);    test_bind (deve, SOCKET_ADDRESS_E);    /*  Run the device. */    rc = nn_device (deve, -1);    nn_assert (rc < 0 && nn_errno () == ETERM);    /*  Clean up. */    test_close (deve);}
开发者ID:0xe,项目名称:nanomsg,代码行数:16,



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


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