Threads vs pthread in perl

Interestingly, between the versions of "THREADS" and "PTHREAD" are different when I compile perl 5.16 (and another version) from the port source in freebsd?

Is PTHREAD a positional thread? (because -pthread) And if so, is "THREADS" preferable? (because it seems to be pre-selected) even on freebsd? And on the other hand, what is "THREADS" ("Kernels"?)? What are the pros and cons?

Can I use both methods in one installation? Does that make sense?

So far I do not see much space in combination with perl, as far as I can tell.

thanks a lot skeleton key

+7
source share
1 answer

The use of threads is as described by others.

Linking to pthread means your perl is built with the -pthread flag. This has a subtle but important effect. This means that when you run perl, libc data that maintains state for the threads is initialized. This means that if your perl calls dlopen () in a library that has threads, it will work correctly, not hang.

PS. I am actually the one who wrote and passed the PTHREAD parameter to the port. I really discovered some perl modules that dlopen () 'd stream libs and caused perl to hang. I thought why. Trust me, you want to enable the PTHREAD option. I am really thinking of removing an option to disable it. See the FreeBSD PR Section 163512 and 163878 for more information. We should probably push this option upstream so that Perl uses this by default in FreeBSD. Anything that dlopen () can call should really be built with -pthread.

+17
source

All Articles