git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2712
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
for(i=0; i<argc; i++)
printf("%s ",argv[i]);
printf(">\n");
for(i=0; i<argc; i++)
printf("%s ",argv[i]);
printf(">\n");
int fA(int argc, char** argv);
int fA(int argc, char** argv)
{
int fA(int argc, char** argv);
int fA(int argc, char** argv)
{
+ printf("Here is fA: ");
- printf("\tA: Yield\n");
+ printf("\tContext A: Yield\n");
- printf("\tA: Yield\n");
+
+ xbt_fifo_push(fifo,cB);
+ printf("\tPush context B from context A\n");
+
+ printf("\tContext A: Yield\n");
+ printf("\tContext A : bye\n");
int fB(int argc, char** argv);
int fB(int argc, char** argv)
{
int fB(int argc, char** argv);
int fB(int argc, char** argv)
{
+ printf("Here is fB: ");
- printf("\tB: Yield\n");
- xbt_context_yield();
+// printf("\tContext B: Yield\n");
+// xbt_context_yield();
- printf("\tB->A\n");
- printf("\tB: Yield\n");
+ printf("\tPush context A from context B\n");
+ printf("\tContext B: Yield\n");
+ printf("\tContext B : bye\n");
int fC(int argc, char** argv);
int fC(int argc, char** argv)
{
int fC(int argc, char** argv);
int fC(int argc, char** argv)
{
+ printf("Here is fC: ");
- printf("\tC: Yield\n");
+ printf("\tContext C: Yield (and exit)\n");
{
xbt_context_t context = NULL;
{
xbt_context_t context = NULL;
+ printf("XXX Test the simgrid context API\n");
+ printf(" If it fails, try another context backend.\n For example, to force the pthread backend, use:\n ./configure --with-context=pthread\n\n");
+
xbt_context_init();
cA = xbt_context_new(fA, NULL, NULL, NULL, NULL, 0, NULL);
xbt_context_init();
cA = xbt_context_new(fA, NULL, NULL, NULL, NULL, 0, NULL);
+ printf("Here is context 'main'\n");
- printf("\tO->A\n");xbt_fifo_push(fifo,cA);
+ printf("\tPush context 'A' from context 'main'\n");xbt_fifo_push(fifo,cA);
- printf("\tO->B\n");xbt_fifo_push(fifo,cB);
+ printf("\tPush context 'B' from context 'main'\n");xbt_fifo_push(fifo,cB);
xbt_context_start(cC);xbt_fifo_push(fifo,cC);
xbt_context_start(cC);xbt_fifo_push(fifo,cC);
- printf("\tO->C\n");xbt_fifo_push(fifo,cC);
+ printf("\tPush context 'C' from context 'main'\n");xbt_fifo_push(fifo,cC);
while((context=xbt_fifo_shift(fifo))) {
while((context=xbt_fifo_shift(fifo))) {
+ printf("Context main: Yield\n");
xbt_context_schedule(context);
}
xbt_context_schedule(context);
}