ezyang’s blog

the arc of software bends towards understanding

Unintended consequences: Bound threads and unsafe FFI calls

A while ago, I wrote a post describing how unsafe FFI calls could block your entire system, and gave the following example of this behavior: /* cbit.c */ #include <stdio.h> int bottom(int a) { while (1) {printf("%d\n", a);sleep(1);} return a; } /* cbit.h */ int bottom(int a); /* UnsafeFFITest.hs */ {-# LANGUAGE ForeignFunctionInterface #-} import […]

  • December 8, 2014