1 /* Copyright (c) 2010. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #include <win32_ucontext.h>
24 if (swapcontext(&uc_child, &uc_main) != 0)
28 int main(int argc, char *argv[])
33 /* the default is that it fails */
34 if ((fp = fopen("conftestval", "w")) == NULL)
39 /* configure a child user-space context */
40 if ((stack = malloc(64*1024)) == NULL)
42 if (getcontext(&uc_child) != 0)
44 uc_child.uc_link = NULL;
45 uc_child.uc_stack.ss_sp = (char *)stack+(32*1024);
46 uc_child.uc_stack.ss_size = 32*1024;
47 uc_child.uc_stack.ss_flags = 0;
48 makecontext(&uc_child, child, 0);
50 /* switch into the user context */
51 if (swapcontext(&uc_main, &uc_child) != 0)
54 /* Fine, child came home */
55 if ((fp = fopen("conftestval", "w")) == NULL)
60 /* die successfully */