| 1 |
Source: libthread-tie-perl |
| 2 |
Maintainer: Debian Perl Group <[email protected]> |
| 3 |
Uploaders: Christopher Hoskin <[email protected]> |
| 4 |
Section: perl |
| 5 |
Testsuite: autopkgtest-pkg-perl |
| 6 |
Priority: optional |
| 7 |
Build-Depends: debhelper-compat (= 13) |
| 8 |
Build-Depends-Indep: libload-perl <!nocheck>, |
| 9 |
libthread-serialize-perl <!nocheck>, |
| 10 |
perl |
| 11 |
Standards-Version: 4.7.2 |
| 12 |
Vcs-Browser: https://salsa.debian.org/perl-team/modules/packages/libthread-tie-perl |
| 13 |
Vcs-Git: https://salsa.debian.org/perl-team/modules/packages/libthread-tie-perl.git |
| 14 |
Homepage: https://metacpan.org/release/Thread-Tie |
| 15 |
Rules-Requires-Root: no |
| 16 |
|
| 17 |
Package: libthread-tie-perl |
| 18 |
Architecture: all |
| 19 |
Depends: ${misc:Depends}, |
| 20 |
${perl:Depends}, |
| 21 |
libload-perl, |
| 22 |
libthread-serialize-perl |
| 23 |
Description: alternative separate thread implementation of shared variables |
| 24 |
The standard shared variable scheme used by Perl, is based on tie-ing the |
| 25 |
variable to some very special dark magic. This dark magic ensures that shared |
| 26 |
variables, which are copied just as any other variable when a thread is |
| 27 |
started, update values in all of the threads where they exist as soon as the |
| 28 |
value of a shared variable is changed. |
| 29 |
. |
| 30 |
The Thread::Tie module is a proof-of-concept implementation of another approach |
| 31 |
to shared variables. Instead of having shared variables exist in all the |
| 32 |
threads from which they are accessible, shared variable exist as "normal", |
| 33 |
unshared variables in a separate thread. Only a tied object exists in each |
| 34 |
thread from which the shared variable is accessible. |
| 35 |
. |
| 36 |
Through the use of a client-server model, any thread can fetch and/or update |
| 37 |
variables living in that thread. This client-server functionality is hidden |
| 38 |
under the hood of tie(). So you could say that one dark magic (the current |
| 39 |
shared variables implementation) is replaced by another dark magic. |
| 40 |
. |
| 41 |
The Thread::Tie approach has the following advantages: |
| 42 |
. |
| 43 |
* Memory usage - This implementation circumvents the memory leak that |
| 44 |
currently (threads::shared version 0.90) plagues any shared array or shared |
| 45 |
hash access. |
| 46 |
* Tieing shared variables - Because the current implementation uses tie-ing, |
| 47 |
you can not tie a shared variable. The same applies for this implementation |
| 48 |
you might say. However, it is possible to specify a non-standard tie |
| 49 |
implementation for use within the thread. So with this implementation you |
| 50 |
can tie() a shared variable. So you could tie a shared hash to a DBM file à |
| 51 |
la dbmopen() with this module. |
| 52 |
. |
| 53 |
Of course there are disadvantages to this approach: |
| 54 |
. |
| 55 |
* Pure Perl implementation - This module is currently a pure Perl |
| 56 |
implementation. This is ok for a proof of concept, but may need re- |
| 57 |
implementation in pure XS or in Inline::C for production use. |
| 58 |
. |
| 59 |
* Tradeoff between cpu and memory - This implementation currently uses (much) |
| 60 |
more cpu than the standard shared variables implementation. Whether this |
| 61 |
would still be true when re-implemented in XS or Inline::C, remains to be |
| 62 |
seen. |