Skip to content

Instantly share code, notes, and snippets.

@waj
Created January 28, 2014 20:28

Revisions

  1. Juan Wajnerman created this gist Jan 28, 2014.
    26 changes: 26 additions & 0 deletions pcl_and_gc.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #include <gc/gc.h>
    #include <pcl.h>
    #include <stdio.h>

    void coroutine(void *arg)
    {
    int i;
    for (i = 0; i < 1000; ++i)
    {
    printf("%d\n", i);
    GC_malloc(1024);
    }
    }

    #define STACK_SIZE 32 * 1024

    int main(int argc, char const *argv[])
    {
    GC_init();
    void *stack = GC_malloc(STACK_SIZE);

    coroutine_t c = co_create(coroutine, 0, stack, STACK_SIZE);
    co_call(c);

    return 0;
    }