CuriousCoder
CuriousCoder

Reputation: 1600

Question on sigsetjmp and siglongjmp

I am trying to understand the sigsetjmp() and siglongjmp() functions. The man pages state that sigsetjmp() saves the context and siglongjmp() restores the context. My question is, will they take care of stack pointer and program counter values as well?

Any links to extra resources are welcome.

Upvotes: 1

Views: 1056

Answers (2)

bdonlan
bdonlan

Reputation: 231213

The stack pointer and program counter are both parts of the context (which you can think of as being, essentially, the state of the CPU registers).

Upvotes: 2

Mat
Mat

Reputation: 206747

Yes, it takes care of all the context. What that is exactly is implementation dependent.

Be sure to read both the spec and your implementation's man pages, and be careful with these functions, they are tricky.

Upvotes: 1

Related Questions