Thread: code problem

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    17

    code problem

    Hi, i have a little problem in my code .

    Code:
        void thread_exit() {
        thread_t running_thread = list->element;
        thread_t next_thread = list->next->element;
        remove_list(&list, running_thread);
        thread_switch(running_thread->context, next_thread->context);
        }
    This function terminate a thread that is running, removing her from the list, and
    after removing her, switch the execution context of the thread with the next thread on the list. The problem is that i have to free the structure(running_thread) and her context, but i cant do it before the thread_switch(), neither immediately after, so how can i resolve this problem.

  2. #2
    Logic Junkie
    Join Date
    Nov 2005
    Posts
    31
    Why can't you remove it after thread_switch()?
    -S

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code problem
    By sybariticak47 in forum C++ Programming
    Replies: 9
    Last Post: 02-28-2006, 11:50 AM
  2. Problem with game code.
    By ajdspud in forum C++ Programming
    Replies: 5
    Last Post: 02-14-2006, 06:39 PM
  3. problem with selection code
    By DavidP in forum Game Programming
    Replies: 1
    Last Post: 06-14-2004, 01:05 PM
  4. Replies: 5
    Last Post: 12-03-2003, 05:47 PM
  5. Help with code for simple Y2K problem
    By Mule in forum C++ Programming
    Replies: 3
    Last Post: 03-06-2003, 12:53 AM