Changeset 2a46e10 in mainline for test/mm/slab2/test.c


Ignore:
Timestamp:
2006-02-16T13:35:02Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3debedec
Parents:
ff4e1cd
Message:

Avoid memory exhaustion in thread_create in slab2 test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/mm/slab2/test.c

    rff4e1cd r2a46e10  
    3535#include <mm/frame.h>
    3636#include <memstr.h>
     37#include <synch/condvar.h>
     38#include <synch/mutex.h>
    3739
    3840#define ITEM_SIZE 256
     
    116118slab_cache_t *thr_cache;
    117119semaphore_t thr_sem;
     120condvar_t thread_starter;
     121mutex_t starter_mutex;
    118122
    119123#define THREADS 8
     
    123127        void *data=NULL, *new;
    124128
     129        mutex_lock(&starter_mutex);
     130        condvar_wait(&thread_starter,&starter_mutex);
     131        mutex_unlock(&starter_mutex);
     132               
    125133        printf("Starting thread #%d...\n",THREAD->tid);
    126134
     
    173181
    174182        printf("Running stress test with size %d\n", size);
     183        condvar_initialize(&thread_starter);
     184        mutex_initialize(&starter_mutex);
     185
    175186        thr_cache = slab_cache_create("thread_cache", size, 0,
    176187                                      NULL, NULL,
     
    182193                thread_ready(t);
    183194        }
     195        thread_sleep(1);
     196        condvar_broadcast(&thread_starter);
    184197
    185198        for (i=0; i<THREADS; i++)
Note: See TracChangeset for help on using the changeset viewer.