Issue #1 new

Information about threadsafety and concurrent operation

Anonymous created an issue

I am new to Haskell, so probably some of the questions are not specific to this library and etc. I've read (and understood many parts of of) http://www.vex.net/~trebla/haskell/ghc-conc-ffi.xhtml .

I understand that to get any FFI concurrency at all, I have to compile with -threaded, and even then only foreign functions imported without "unsafe" marking will be run in parallel. (If I got sth wrong, say) If I call Network.Pcap from multiple threads, it won't crash anything, right? pcap_compile is imported without "unsafe", but the C function is not threadsafe according to http://seclists.org/tcpdump/2009/q1/62 .

Is there any benefit at all of using multiple threads (to send and receive on multiple interfaces)? Should I create one thread per interface (sending and receiving in the same thread), two (sending and receiving separately), or just dispatch the packet handling using one thread per interface and send packets from any thread where I feel like it?

Comments (0)

  1. Log in to comment