Capture with threads, works on Linux and Darwin