Changeset dc747e3 in mainline for test


Ignore:
Timestamp:
2005-12-15T10:27:59Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7dd2561
Parents:
3fc03fd
Message:

Add SPINLOCK_DECLARE and SPINLOCK_INITIALIZE macros.
SPINLOCK_DECLARE is to be used instead of direct spinlock_t declarations
in dynamically allocated structures on which spinlock_initialize() is called after
their creation.
SPINLOCK_INITIALIZE is to be used instead of direct spinlock_t declarations
of global spinlocks. It declares and initializes the spinlock.
Moreover, both macros are empty on UP so that -Wall warnings about unused structures
get supressed.

Location:
test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • test/synch/rwlock4/test.c

    r3fc03fd rdc747e3  
    4040#include <synch/rwlock.h>
    4141#include <synch/synch.h>
     42#include <synch/spinlock.h>
    4243
    4344#define READERS         50
     
    4647static rwlock_t rwlock;
    4748
    48 static spinlock_t lock;
     49SPINLOCK_INITIALIZE(lock);
    4950
    5051static waitq_t can_start;
  • test/synch/semaphore2/test.c

    r3fc03fd rdc747e3  
    3838#include <synch/semaphore.h>
    3939#include <synch/synch.h>
     40#include <synch/spinlock.h>
    4041
    4142static semaphore_t sem;
    4243
    43 static spinlock_t lock;
     44SPINLOCK_INITIALIZE(lock);
    4445
    4546static waitq_t can_start;
  • test/thread/thread1/test.c

    r3fc03fd rdc747e3  
    3838#include <arch.h>
    3939
    40 
    41 
    4240#define THREADS 5
    43 
    4441
    4542static void thread(void *data)
     
    5249}
    5350
    54 
    55 
    5651void test(void)
    5752{
     
    5954        int i;
    6055
    61 
    62 
    63         for (i=0; i<THREADS; i++)
    64         { 
     56        for (i=0; i<THREADS; i++) { 
    6557                if (!(t = thread_create(thread, NULL, TASK, 0)))
    6658                        panic("could not create thread\n");
     
    6860        }
    6961        printf("ok\n");
    70        
    7162}
Note: See TracChangeset for help on using the changeset viewer.