Thread: Is anyone familiar with ucontext?

  1. #1
    Registered User
    Join Date
    Jul 2007

    Is anyone familiar with ucontext?

    I'm trying to use ucontext to create a thread library but I'm segfaulting. I'm using the debugger so I know what the problem is but I don't really understand why. Using debugger I can see that the ucontext_ptr2 in Thread struct is always 0. The ucontext_ptr that I declared in the method however, does get a value but I just put that in as a test so when I call getContext it fails.

    struct Thread
    	char* stack;
    	ucontext_t* ucontext_ptr;
    	int heldLock;
    	int blockedLock;
    	int cv;
    int thread_create(thread_startfunc_t func, void *arg)
    	cout << "Creating Thread" << endl;
    	Thread* t = new Thread;
    	ucontext_t* ucontext_ptr2;
    	t->heldLock = -1;
    	t->blockedLock = -1;
    	t->cv = -1;
    //////more code
    Last edited by jcafaro10; 02-01-2009 at 03:44 PM.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I dont know if your familiar with circlemud but..
    By errigour in forum C Programming
    Replies: 0
    Last Post: 03-25-2009, 05:27 AM
  2. anyone familiar with ubuntu?
    By ktran03 in forum C Programming
    Replies: 2
    Last Post: 03-01-2009, 06:23 PM
  3. Anyone familiar with Powerplugs?
    By indigo0086 in forum A Brief History of
    Replies: 2
    Last Post: 11-04-2006, 12:54 AM
  4. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM
  5. Anybody Familiar with A.L.I.C.E. bot?
    By blackwyvern in forum C++ Programming
    Replies: 6
    Last Post: 01-23-2002, 10:53 PM