ChinaUnix.net
相关文章推荐:

ucontext

#include stdio.h> #include stdlib.h> #include ucontext.h>   /* This is the iterator function. It is entered on the first call to  * swapcontext, and loops from 0 to 9. Each value is saved in i_from_iterator,  * and then swapcontext used to return to the main loop. The main loop prints  * the value and calls swapcontext to swap back into the function. When the end &...

by gaocheng - Linux文档专区 - 2009-12-31 13:24:30 阅读(1068) 回复(0)

相关讨论

#include #include #include static ucontext_t uctx_main, uctx_func1, uctx_func2; #define die(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0) static void func1(void) { printf("func1: started\n"); printf("func1: swapcontext(&uctx_func1, &uctx_func2)\n"); if (swapcontext(&uctx_func1, &uctx_func2) == -1) die("swapcontext"); printf("func1: returning\n"); } static void f...

by nahuat - Linux文档专区 - 2008-12-24 18:42:53 阅读(1180) 回复(0)

man 了一下,不太明白,google了一下好像也没太多讲解, 不知道有没有人可以指点一下这几个函数的大概用法来实现threaded program。 非常感谢!

by leonbnu - 程序开发 - 2006-09-21 05:25:19 阅读(3832) 回复(2)

man 了一下,不太明白,google了一下好像也没太多讲解, 不知道有没有人可以指点一下这几个函数的大概用法来实现threaded program。 非常感谢!

by leonbnu - Linux环境编程 - 2006-09-21 05:25:19 阅读(3512) 回复(2)