source: bootcd/isolinux/syslinux-6.03/core/thread/exit_thread.c

Last change on this file was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 690 bytes
Line 
1#include <limits.h>
2#include <stdlib.h>
3#include <klibc/compiler.h>
4#include "thread.h"
5#include "core.h"
6
7__noreturn __exit_thread(void)
8{
9    struct thread *curr = current();
10
11    cli();
12
13    /* Remove from the linked list */
14    curr->list.prev->next = curr->list.next;
15    curr->list.next->prev = curr->list.prev;
16
17    /* Free allocated stacks (note: free(NULL) is permitted and safe). */
18    free(curr->stack);
19    free(curr->rmstack);
20
21    /*
22     * Note: __schedule() can explictly handle the case where
23     * curr isn't part of the linked list anymore, as long as
24     * curr->list.next is still valid.
25     */
26    __schedule();
27
28    /* We should never get here */
29    kaboom();
30}
Note: See TracBrowser for help on using the repository browser.