[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Sad Clouds <cryintothebluesky%googlemail.com@localhost> wrote:
> At a later time, another thread goes through the global data
> structure, loads each thread's ucontext with setcontext() and runs
> that thread where it left off.
> Is it safe to do the above with detached threads? When a thread
> calls getcontext() does it get a complete copy of its context, or
> does the context contain some pointers to the current thread's
> data. So that if this detached thread terminates and later another
> thread is created, the memory will be recycled and the previously
> saved context will point to memory now owned by the new thread??
Yes. E.g. ucontext contains sp, but it's your responsibility to have
that stack area still valid, so that when you resume that context sp
points to something sane.
uwe%stderr.spb.ru@localhost | Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/ | Ist zu Grunde gehen
Main Index |
Thread Index |