P5-threads

Jul 20, 2023

Perl interpreter-based threads

Perl 5.6 introduced something called interpreter threads. Interpreter threads are different from 5005threads the thread model of Perl 5.005 by creating a new Perl interpreter per thread, and not sharing any data or state between threads by default.

Prior to Perl 5.8, this has only been available to people embedding Perl, and for emulating fork on Windows.

The threads API is loosely based on the old Thread.pm API. It is very important to note that variables are not shared between threads, all variables are by default thread local. To use shared variables one must use threadsshared.

It is also important to note that you must enable threads by doing use threads as early as possible in the script itself, and that it is not possible to enable threading inside an eval “”, do, require, or use. In particular, if you are intending to share variables with threadsshared, you must use threads before you use threadsshared. threads will emit a warning if you do it the other way around.



Checkout these related ports:
  • Zziplib - Library to provide transparent read access to zipped files
  • Zydis - Fast and lightweight x86/x86-64 disassembler library
  • Zycore-c - Support library with platform independent types, macros, etc for Zydis
  • Zthread - Platform-independent object-oriented C++ threading library
  • Zookeeper - Coordination Service for Distributed Applications
  • Zls - Zig LSP implementation + Zig Language Server
  • Zfp - High throughput library for compressed floating-point arrays
  • Zeal - Offline documentation browser
  • Zapcc - C++ caching compiler based on clang
  • Zanata-platform - Web-based translation platform
  • Zanata-cli - Zanata Java command line client
  • Z88dk - Complete Z80/Z180 development kit
  • Z80ex - ZiLOG Z80 CPU emulator library
  • Z80asm - Assembler for the Z80 microprocessor
  • Z80-asm - Z80 assembly code assembler and disassembler