Subversion Repositories HelenOS

Rev

Rev 2131 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2131 Rev 2307
Line 148... Line 148...
148
    mutex_lock(&starter_mutex);
148
    mutex_lock(&starter_mutex);
149
    condvar_wait(&thread_starter,&starter_mutex);
149
    condvar_wait(&thread_starter,&starter_mutex);
150
    mutex_unlock(&starter_mutex);
150
    mutex_unlock(&starter_mutex);
151
   
151
   
152
    if (!sh_quiet)
152
    if (!sh_quiet)
153
        printf("Starting thread #%d...\n",THREAD->tid);
153
        printf("Starting thread #%llu...\n",THREAD->tid);
154
 
154
 
155
    /* Alloc all */
155
    /* Alloc all */
156
    if (!sh_quiet)
156
    if (!sh_quiet)
157
        printf("Thread #%d allocating...\n", THREAD->tid);
157
        printf("Thread #%llu allocating...\n", THREAD->tid);
158
   
158
   
159
    while (1) {
159
    while (1) {
160
        /* Call with atomic to detect end of memory */
160
        /* Call with atomic to detect end of memory */
161
        new = slab_alloc(thr_cache, FRAME_ATOMIC);
161
        new = slab_alloc(thr_cache, FRAME_ATOMIC);
162
        if (!new)
162
        if (!new)
Line 164... Line 164...
164
        *((void **) new) = data;
164
        *((void **) new) = data;
165
        data = new;
165
        data = new;
166
    }
166
    }
167
   
167
   
168
    if (!sh_quiet)
168
    if (!sh_quiet)
169
        printf("Thread #%d releasing...\n", THREAD->tid);
169
        printf("Thread #%llu releasing...\n", THREAD->tid);
170
   
170
   
171
    while (data) {
171
    while (data) {
172
        new = *((void **)data);
172
        new = *((void **)data);
173
        *((void **) data) = NULL;
173
        *((void **) data) = NULL;
174
        slab_free(thr_cache, data);
174
        slab_free(thr_cache, data);
175
        data = new;
175
        data = new;
176
    }
176
    }
177
   
177
   
178
    if (!sh_quiet)
178
    if (!sh_quiet)
179
        printf("Thread #%d allocating...\n", THREAD->tid);
179
        printf("Thread #%llu allocating...\n", THREAD->tid);
180
   
180
   
181
    while (1) {
181
    while (1) {
182
        /* Call with atomic to detect end of memory */
182
        /* Call with atomic to detect end of memory */
183
        new = slab_alloc(thr_cache, FRAME_ATOMIC);
183
        new = slab_alloc(thr_cache, FRAME_ATOMIC);
184
        if (!new)
184
        if (!new)
Line 186... Line 186...
186
        *((void **) new) = data;
186
        *((void **) new) = data;
187
        data = new;
187
        data = new;
188
    }
188
    }
189
   
189
   
190
    if (!sh_quiet)
190
    if (!sh_quiet)
191
        printf("Thread #%d releasing...\n", THREAD->tid);
191
        printf("Thread #%llu releasing...\n", THREAD->tid);
192
   
192
   
193
    while (data) {
193
    while (data) {
194
        new = *((void **)data);
194
        new = *((void **)data);
195
        *((void **) data) = NULL;
195
        *((void **) data) = NULL;
196
        slab_free(thr_cache, data);
196
        slab_free(thr_cache, data);
197
        data = new;
197
        data = new;
198
    }
198
    }
199
   
199
   
200
    if (!sh_quiet)
200
    if (!sh_quiet)
201
        printf("Thread #%d finished\n", THREAD->tid);
201
        printf("Thread #%llu finished\n", THREAD->tid);
202
   
202
   
203
    slab_print_list();
203
    slab_print_list();
204
    semaphore_up(&thr_sem);
204
    semaphore_up(&thr_sem);
205
}
205
}
206
 
206