Subversion Repositories HelenOS-historic

Rev

Rev 785 | Rev 788 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 785 Rev 787
Line 235... Line 235...
235
 *
235
 *
236
 * Second part of the scheduler() function
236
 * Second part of the scheduler() function
237
 * using new stack. Handling the actual context
237
 * using new stack. Handling the actual context
238
 * switch to a new thread.
238
 * switch to a new thread.
239
 *
239
 *
-
 
240
 * Assume THREAD->lock is held.
240
 */
241
 */
241
static void scheduler_separated_stack(void)
242
static void scheduler_separated_stack(void)
242
{
243
{
243
    int priority;
244
    int priority;
244
 
245
 
Line 251... Line 252...
251
            spinlock_unlock(&THREAD->lock);
252
            spinlock_unlock(&THREAD->lock);
252
            thread_ready(THREAD);
253
            thread_ready(THREAD);
253
            break;
254
            break;
254
 
255
 
255
            case Exiting:
256
            case Exiting:
256
            frame_free((__address) THREAD->kstack);
-
 
257
            if (THREAD->ustack) {
-
 
258
                frame_free((__address) THREAD->ustack);
-
 
259
            }
-
 
260
 
-
 
261
            /*
-
 
262
             * Detach from the containing task.
-
 
263
             */
-
 
264
            spinlock_lock(&TASK->lock);
-
 
265
            list_remove(&THREAD->th_link);
-
 
266
            spinlock_unlock(&TASK->lock);
-
 
267
 
-
 
268
            spinlock_unlock(&THREAD->lock);
-
 
269
   
-
 
270
            spinlock_lock(&threads_lock);
-
 
271
            list_remove(&THREAD->threads_link);
-
 
272
            spinlock_unlock(&threads_lock);
-
 
273
 
-
 
274
            spinlock_lock(&CPU->lock);
-
 
275
            if(CPU->fpu_owner==THREAD)
-
 
276
                CPU->fpu_owner=NULL;
-
 
277
            spinlock_unlock(&CPU->lock);
-
 
278
 
-
 
279
            free(THREAD);
257
            thread_destroy(THREAD);
280
 
-
 
281
            break;
258
            break;
282
   
259
           
283
            case Sleeping:
260
            case Sleeping:
284
            /*
261
            /*
285
             * Prefer the thread after it's woken up.
262
             * Prefer the thread after it's woken up.
286
             */
263
             */
287
            THREAD->priority = -1;
264
            THREAD->priority = -1;