• 大小: 9.12M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-01-30
  • 语言: 其他
  • 标签: 语言  

资源简介

《go语言编程3》pdf以及源代码下载

资源截图

代码片段和文件信息

#include 
#include 

static ucontext_t ctx[3];


static void
f1 (void)
{
    puts(“start f1“);
    swapcontext(&ctx[1] &ctx[2]);
    puts(“finish f1“);
}


static void
f2 (void)
{
    puts(“start f2“);
    swapcontext(&ctx[2] &ctx[1]);
    puts(“finish f2“);
}


int
main (void)
{
    char st1[8192];
    char st2[8192];
    
    
    getcontext(&ctx[1]);
    ctx[1].uc_stack.ss_sp = st1;
    ctx[1].uc_stack.ss_size = sizeof st1;
    ctx[1].uc_link = &ctx[0];
    makecontext(&ctx[1] f1 0);
    
    
    getcontext(&ctx[2]);
    ctx[2].uc_stack.ss_sp = st2;
    ctx[2].uc_stack.ss_size = sizeof st2;
    ctx[2].uc_link = &ctx[1];
    makecontext(&ctx[2] f2 0);
    
    
    swapcontext(&ctx[0] &ctx[2]);
    return 0;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-04-28 13:19  gobook-src\
     文件       12292  2012-08-20 16:41  gobook-src\.DS_Store
     目录           0  2012-04-26 22:28  gobook-src\chapter1\
     文件        6148  2012-04-26 22:52  gobook-src\chapter1\.DS_Store
     目录           0  2012-04-26 22:38  gobook-src\chapter1\calcproj\
     文件        6148  2012-04-26 22:17  gobook-src\chapter1\calcproj\.DS_Store
     目录           0  2012-04-26 22:38  gobook-src\chapter1\calcproj\bin\
     文件     1306640  2012-04-26 22:38  gobook-src\chapter1\calcproj\bin\calc
     目录           0  2012-04-26 22:38  gobook-src\chapter1\calcproj\pkg\
     目录           0  2012-04-26 22:38  gobook-src\chapter1\calcproj\pkg\darwin_amd64\
     文件        5328  2012-04-26 22:38  gobook-src\chapter1\calcproj\pkg\darwin_amd64\simplemath.a
     目录           0  2012-04-26 22:31  gobook-src\chapter1\calcproj\src\
     目录           0  2012-04-26 22:30  gobook-src\chapter1\calcproj\src\calc\
     文件        1404  2012-04-26 22:30  gobook-src\chapter1\calcproj\src\calc\calc.go
     目录           0  2012-04-26 22:34  gobook-src\chapter1\calcproj\src\simplemath\
     文件          78  2012-04-26 22:32  gobook-src\chapter1\calcproj\src\simplemath\add.go
     文件         187  2012-04-26 22:32  gobook-src\chapter1\calcproj\src\simplemath\add_test.go
     文件         120  2012-04-26 22:34  gobook-src\chapter1\calcproj\src\simplemath\sqrt.go
     文件         187  2012-04-26 22:34  gobook-src\chapter1\calcproj\src\simplemath\sqrt_test.go
     文件         119  2012-04-26 22:43  gobook-src\chapter1\cprint.go
     文件         147  2012-04-26 22:29  gobook-src\chapter1\hello.go
     文件         505  2012-04-26 22:49  gobook-src\chapter1\paracalc.go
     文件     1208336  2012-04-26 22:27  gobook-src\chapter1\reflect
     文件         458  2012-04-26 22:25  gobook-src\chapter1\reflect.go
     目录           0  2012-04-26 23:11  gobook-src\chapter2\
     文件        6148  2012-04-26 23:11  gobook-src\chapter2\.DS_Store
     文件         269  2012-04-26 23:11  gobook-src\chapter2\closure.go
     文件         495  2012-04-07 21:00  gobook-src\chapter2\for1.go
     文件         725  2012-04-07 20:29  gobook-src\chapter2\map1.go
     文件         458  2012-04-07 20:23  gobook-src\chapter2\slice1.go
     文件         169  2012-04-07 21:09  gobook-src\chapter2\slice2.go
............此处省略112个文件信息

评论

共有 条评论