From: "Lee Chin" <leechin@mail.com>
To: linux-newbie@vger.kernel.org
Subject: why does this program crash while using setcontext?
Date: Mon, 20 Jan 2003 01:10:01 -0500 [thread overview]
Message-ID: <20030120061001.72340.qmail@mail.com> (raw)
#include <ucontext.h>
#include <stdio.h>
ucontext_t mainucp;
ucontext_t fooucp;
int flag = 0;
int foo()
{
printf("(2) foo setting context\n");
getcontext(&fooucp);
if (!flag)
{
flag = 1;
setcontext(&mainucp);
}
printf("(3) foo done\n");
return 0;
}
void eleven()
{
printf("(1) calling foo\n");
foo();
printf("(4) foo now finished\n");
}
void ten()
{
eleven();
}
void nine()
{
ten();
}
void eight()
{
nine();
}
void seven()
{
eight();
}
void six()
{
seven();
}
void five()
{
six();
}
void four()
{
five();
}
void three()
{
four();
}
void two()
{
three();
}
void one()
{
two();
}
int main()
{
getcontext(&mainucp);
if (!flag)
{
one();
}
else
{
printf("(2.5) main again\n");
setcontext(&fooucp);
}
}
~
--
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
Meet Singles
http://corp.mail.com/lavalife
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next reply other threads:[~2003-01-20 6:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-20 6:10 Lee Chin [this message]
2003-01-20 14:32 ` why does this program crash while using setcontext? Steven Smith
-- strict thread matches above, loose matches on Subject: below --
2003-01-20 16:12 Lee Chin
2003-01-21 8:13 Lee Chin
2003-01-21 16:39 ` Steven Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030120061001.72340.qmail@mail.com \
--to=leechin@mail.com \
--cc=linux-newbie@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox