A small doubt regarding the context related functions..

I did a makecontext to create a new thread. ( C program)
But in order to execute it,I need to know the main parent thread so that I can swap both.

How do i know the parent thread..?

i want to use swapcontext(<----> , &child thread);

what do i fill in here in order to swap context with parent thread ?

10 Years
Discussion Span
Last Post by Ancient Dragon

What operating system? Is it something that you are writing ? I did something similar in MS-DOS 6.X (a program with multiple context threads). In that program I had a kernel function (kernel to my program) that pushed all registers onto the stack, switch stacks, then poped registers of the new thread. This did not require any context id's

I have no clue what your swapcontext function does, other than swap out one thread for another.


I am using GNU C Library on UNIX platform.
I am trying to create a child thread(makecontext) and swap it with the parent thread.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.