Exemplo n.º 1
0
TEST(List, Thread)
{
    ThreadTest tt = { 0, MUTEX_INIT, };

    // check the test works
    thrash(& tt);
    EXPECT_EQ(0, tt.head);

    int num = 100;
    pthread_t threads[num];

    for (int i = 0; i < num; i++)
    {
        int err = pthread_create(& threads[i], 0, thrash, & tt);
        ASSERT(err == 0);
    }

    for (int i = 0; i < num; i++)
    {
        int err = pthread_join(threads[i], 0);
        ASSERT(err == 0);
    }

    // should be an empty list
    EXPECT_EQ(0, tt.head);
    int size = item_size(& tt.head);
    EXPECT_EQ(0, size);
}
Exemplo n.º 2
0
int main(int argc, char **argv) {
    GapIO *io;
    int status;
    time_t seed = time(NULL);

    if (argc == 2) {
	seed = atoi(argv[1]);
    }
    printf("Seed=%ld\n", seed);
    srandom(seed);

    system("/bin/rm thrash2.0*");
    io = open_db("thrash2", "0", &status, 1, 0);
    thrash(io);

    close_db(io);
}
Exemplo n.º 3
0
Arquivo: thrash.c Projeto: gz/aos10
/**
 * This process never finishes. Used to test
 * the kill command.
 **/
int main(void) {
	thrash();
}