threads vs. pthread in perl threads vs. pthread in perl multithreading multithreading

threads vs. pthread in perl


Using threads is as others have described it of course.

The link with pthread means that your perl is built with the -pthread flag. This has a subtle but important effect. It means that when perl starts up, the libc data that maintains state for threads is initialized. This means that if your perl calls dlopen() on a library which is threaded, it will work properly, instead of hanging.

PS. I'm actually the person who wrote and committed the PTHREAD option to the port. I actually discovered some perl modules which dlopen()'d some threaded libs and caused perl to hang. Took me a while to figure out why. Trust me, you want the PTHREAD option on. I'm actually thinking of removing the option to turn it off. For more info, see FreeBSD PR 163512 and 163878. We probably should push this option upstream so that perl uses this by default on FreeBSD. Anything that may call dlopen() should really be built with -pthread.