Run longer tests
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Fri, 6 Feb 2009 11:13:49 +0000 (06:13 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Fri, 6 Feb 2009 11:13:49 +0000 (06:13 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
test_urcu.c

index 17061f81a250d5f12f7e4836d7caf81835cd43d4..db0b68ca2d18cc58cc0bd163a938375773ec660c 100644 (file)
@@ -42,7 +42,7 @@ void *thr_reader(void *arg)
 
        urcu_register_thread();
 
 
        urcu_register_thread();
 
-       for (i = 0; i < 1000; i++) {
+       for (i = 0; i < 100000; i++) {
                for (j = 0; j < 100000000; j++) {
                        qparity = rcu_read_lock();
                        local_ptr = rcu_dereference(test_rcu_pointer);
                for (j = 0; j < 100000000; j++) {
                        qparity = rcu_read_lock();
                        local_ptr = rcu_dereference(test_rcu_pointer);
@@ -70,18 +70,18 @@ void *thr_writer(void *arg)
                        "writer", pthread_self(), (unsigned long)getpid());
        sleep(2);
 
                        "writer", pthread_self(), (unsigned long)getpid());
        sleep(2);
 
-       for (i = 0; i < 100000; i++) {
-               rcu_write_lock();
+       for (i = 0; i < 10000000; i++) {
                new = malloc(sizeof(struct test_array));
                new = malloc(sizeof(struct test_array));
+               rcu_write_lock();
                old = test_rcu_pointer;
                if (old) {
                        assert(old->a == 8);
                        assert(old->b == 12);
                        assert(old->c[55] == 2);
                }
                old = test_rcu_pointer;
                if (old) {
                        assert(old->a == 8);
                        assert(old->b == 12);
                        assert(old->c[55] == 2);
                }
-               new->a = 8;
-               new->b = 12;
                new->c[55] = 2;
                new->c[55] = 2;
+               new->b = 12;
+               new->a = 8;
                old = urcu_publish_content((void **)&test_rcu_pointer, new);
                rcu_write_unlock();
                /* can be done after unlock */
                old = urcu_publish_content((void **)&test_rcu_pointer, new);
                rcu_write_unlock();
                /* can be done after unlock */
This page took 0.02586 seconds and 4 git commands to generate.