Changeset cb01e1e in mainline for kernel/test/synch/rwlock2.c


Ignore:
Timestamp:
2009-04-04T00:26:27Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a85aebd
Parents:
171f9a1
Message:

use global variable and a macro for silencing tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/synch/rwlock2.c

    r171f9a1 rcb01e1e  
    3535#include <synch/rwlock.h>
    3636
    37 #define READERS         50
    38 #define WRITERS         50
     37#define READERS  50
     38#define WRITERS  50
    3939
    4040static rwlock_t rwlock;
    41 static bool sh_quiet;
    4241
    4342static void writer(void *arg)
    4443{
    45         if (!sh_quiet)
    46                 printf("Trying to lock rwlock for writing....\n");
     44        TPRINTF("Trying to lock rwlock for writing....\n");
    4745       
    4846        rwlock_write_lock(&rwlock);
    4947        rwlock_write_unlock(&rwlock);
    5048       
    51         if (!sh_quiet)
    52                 printf("Trying to lock rwlock for reading....\n");
     49        TPRINTF("Trying to lock rwlock for reading....\n");
    5350       
    5451        rwlock_read_lock(&rwlock);
    55         rwlock_read_unlock(&rwlock);   
     52        rwlock_read_unlock(&rwlock);
    5653}
    5754
    58 char * test_rwlock2(bool quiet)
     55char *test_rwlock2(void)
    5956{
    6057        thread_t *thrd;
    61         sh_quiet = quiet;
    6258       
    6359        rwlock_initialize(&rwlock);
    64 
     60       
    6561        rwlock_read_lock(&rwlock);
    6662        rwlock_read_lock(&rwlock);
    6763        rwlock_read_lock(&rwlock);
    68         rwlock_read_lock(&rwlock);     
     64        rwlock_read_lock(&rwlock);
    6965       
    7066        thrd = thread_create(writer, NULL, TASK, 0, "writer", false);
     
    7369        else
    7470                return "Could not create thread";
    75 
     71       
    7672        thread_sleep(1);
    7773       
Note: See TracChangeset for help on using the changeset viewer.