| 1 |
0.35 June 26 2014 |
| 2 |
***** Bug fixes ***** |
| 3 |
|
| 4 |
Fix manager process blocking issue if a child thread dies while waiting on a signal. (RT#69578) |
| 5 |
|
| 6 |
0.36 June 25 2014 |
| 7 |
***** Bug fixes ***** |
| 8 |
|
| 9 |
Fix a usage bug with an each iterator in manager process. (RT#56263) |
| 10 |
Improves compatibility with Perl 5.18 and later. |
| 11 |
|
| 12 |
Support prompt from ExtUtils::MakeMaker when available. (RT#82781) |
| 13 |
|
| 14 |
***** Threads API consistency changes ***** |
| 15 |
|
| 16 |
Bumped threads $VERSION to 1.92, threads::shared $VERSION to 1.39. to match |
| 17 |
version-supported features and behavior. |
| 18 |
|
| 19 |
***** Miscellaneous changes ***** |
| 20 |
|
| 21 |
Support Makefile.PL env FORKS_SIMULATE_USEITHREADS=1 option to auto-install forks in |
| 22 |
place of threads namespace for non-ithreaded Perl build. (RT#69880) |
| 23 |
|
| 24 |
0.34 June 14 2010 |
| 25 |
***** Bug fixes ***** |
| 26 |
|
| 27 |
Fix compatibility with perl 5.11 and later. (RT#56263) |
| 28 |
(Possible bug in core each() iterator, when using blessed globrefs as hash keys?) |
| 29 |
|
| 30 |
Main thread will no longer be ABRT signalled (to exit) if it is already shutting down. |
| 31 |
|
| 32 |
Fix usleep behavior on platforms without nanosleep support. (RT#52782) |
| 33 |
|
| 34 |
Fix test skip counts in forks08.t. (RT#52781) |
| 35 |
|
| 36 |
***** Threads API consistency changes ***** |
| 37 |
|
| 38 |
Bumped threads $VERSION to 1.77, threads::shared $VERSION to 1.33 to match |
| 39 |
version-supported features and behavior. |
| 40 |
|
| 41 |
***** Miscellaneous changes ***** |
| 42 |
|
| 43 |
Runtime 'require threads::shared' now correctly loads forks::shared in an ithreads-enabled |
| 44 |
Perl, as long as 'forks' was loaded first. Can default to the previous behavior with a |
| 45 |
true-value environment variable, THREADS_NO_PRELOAD_SHARED. (RT#56139) |
| 46 |
|
| 47 |
Use SvGETMAGIC macro instead of mg_get. |
| 48 |
|
| 49 |
Add module dependency requirements test. |
| 50 |
|
| 51 |
Updated to ppport.h 3.19. |
| 52 |
|
| 53 |
0.33 April 8 2009 |
| 54 |
***** Bug fixes ***** |
| 55 |
|
| 56 |
exit() in child process after fork() in user code no longer causes process hang. |
| 57 |
|
| 58 |
Address issue with Devel::Symdump and internal typeglob reference changes in Perl 5.10. |
| 59 |
|
| 60 |
***** Miscellaneous changes ***** |
| 61 |
|
| 62 |
Removed Devel::Required (used only for forks development) from Makefile.PL required |
| 63 |
modules. |
| 64 |
|
| 65 |
0.32 March 18 2009 |
| 66 |
***** Miscellaneous changes ***** |
| 67 |
|
| 68 |
Minor change to forks08.t nanosleep usage when not available, to avoid srror. |
| 69 |
|
| 70 |
Made time tolerances consistent throughout forks08.t. |
| 71 |
|
| 72 |
0.31 March 14 2009 |
| 73 |
***** Threads API consistency changes ***** |
| 74 |
|
| 75 |
Module CLONE and CLONE_SKIP functions now are passed package name as first argument. |
| 76 |
|
| 77 |
When CLONE_SKIP true in package, all objects in child threads are now cleared. This |
| 78 |
occurs after fork (unavoidable affect of system fork COW), which hopefully should |
| 79 |
be portable with all non-perl modules. Note that arrays and hashes will be emptied, |
| 80 |
but not converted to undef scalar ref; this differs from ithreads (where all become |
| 81 |
undef scalar ref). Patches are welcome. |
| 82 |
|
| 83 |
Bumped threads $VERSION to 1.72, threads::shared $VERSION to 1.28 to match |
| 84 |
version-supported features and behavior. |
| 85 |
|
| 86 |
***** Bug fixes ***** |
| 87 |
|
| 88 |
Improve package detection for CLONE and CLONE_SKIP; now identifies all packages in |
| 89 |
symbol table, not just packages identified by %INC. This allows for support of |
| 90 |
multiple modules in a file/module that may have CLONE or CLONE_SKIP functions. |
| 91 |
|
| 92 |
Improved Time::HiRes::nanosleep support detection. |
| 93 |
|
| 94 |
Corrected possible race condition with $thr->get_stack_size(). Documented |
| 95 |
expected behavior. |
| 96 |
|
| 97 |
***** Miscellaneous changes ***** |
| 98 |
|
| 99 |
Added preliminary Perl debugger support. Defaults to tying TTY only to main thread, |
| 100 |
unless breakpoints exist in user code. |
| 101 |
|
| 102 |
Add some time tolerance in forks08.t, to accomodate for busy systems or slow signal |
| 103 |
handling. |
| 104 |
|
| 105 |
New CPAN module requirements: Devel::Symdump and Acme::Damn. |
| 106 |
|
| 107 |
Updated to ppport.h 3.16. |
| 108 |
|
| 109 |
0.30 February 16 2009 |
| 110 |
***** Bug fixes ***** |
| 111 |
|
| 112 |
Don't overload/define Time::HiRes usleep or nanosleep unless they are supported |
| 113 |
on target platform. |
| 114 |
|
| 115 |
Check for "Invalid value for shared scalar" errors when storing values in |
| 116 |
shared scalars. |
| 117 |
|
| 118 |
Shared scalar values containing user tied objects will no longer be treated as |
| 119 |
threads::shared objects when checking for circular references. |
| 120 |
|
| 121 |
***** Miscellaneous changes ***** |
| 122 |
|
| 123 |
Overloaded sleep total sleep time is more accurate in cases where it might be |
| 124 |
interrupted by child thread shutdown (CHLD) signals. |
| 125 |
|
| 126 |
0.29 February 2 2009 |
| 127 |
***** Bug fixes ***** |
| 128 |
|
| 129 |
Shared variables that reference shared variables now consistently report the |
| 130 |
same thread-local reference memory address. |
| 131 |
|
| 132 |
Code refs can now be used as hash keys. |
| 133 |
|
| 134 |
Fix spurious warnings regarding mismatched Time::HiRes prototypes. |
| 135 |
|
| 136 |
Explicit mg_get in is_shared() to insure tied scalar fetched before ref check. |
| 137 |
|
| 138 |
***** Threads API consistency changes ***** |
| 139 |
|
| 140 |
Can now store CODE refs in shared variables if using Storable >= 2.05. |
| 141 |
|
| 142 |
Can now use CODE refs as shared variable keys (stringified values work as |
| 143 |
expected). |
| 144 |
|
| 145 |
Bumped threads::shared $VERSION to 1.27 to match version-supported features |
| 146 |
and behavior. |
| 147 |
|
| 148 |
***** Miscellaneous changes ***** |
| 149 |
|
| 150 |
Add Makefile build option to upgrade Storable to support using CODE refs in |
| 151 |
shared variable keys, if using Storable 2.05 or later. |
| 152 |
|
| 153 |
Round test suite sleep time check sensitivity to eliminate false positives on |
| 154 |
some (hardware) platforms. |
| 155 |
|
| 156 |
Using more portable prototype definitions with some versions of Test::HiRes. |
| 157 |
|
| 158 |
Scalar::Util 1.11 or later now required. |
| 159 |
|
| 160 |
Sys::SigAction 0.11 or later now required, as this correctly handles the |
| 161 |
'safe' sigaction attribute. |
| 162 |
|
| 163 |
Fix typo in croak error text in cond_timedwait. |
| 164 |
|
| 165 |
0.28 December 30 2008 |
| 166 |
***** Bug fixes ***** |
| 167 |
|
| 168 |
join() and detach() now correctly propagate and throw exceptions to threads, |
| 169 |
in such cases as joining or detaching an already joined or detached thread. |
| 170 |
|
| 171 |
Threads now supports circular self-referential shared variables |
| 172 |
(i.e. my $x:shared; $x = \$x;) and consistently returns the correct REF value; |
| 173 |
circular-referental sets of variables are also supported, if defined before |
| 174 |
sharing with shared_clone()). |
| 175 |
|
| 176 |
forks::shared function is_shared() now understands REF type input and circular |
| 177 |
referential shared variables. |
| 178 |
|
| 179 |
is_shared() should now return a consistent address in all threads and for |
| 180 |
all variable types; however, note since it refences memory in the shared |
| 181 |
process, do NOT use the return value to perform direct memory access (not that |
| 182 |
it was intended for this purpose, anyway). |
| 183 |
|
| 184 |
Using single-declaration form of 'use constant' for Perl 5.6.x compatibility. |
| 185 |
|
| 186 |
Explicitly registering 'threads' warnings pragma, for Perl 5.6.x compatibility. |
| 187 |
|
| 188 |
Added more XS prototype compatibility with 5.6.x, allowing second forms of |
| 189 |
cond_wait and cond_timedwait to be better supported. |
| 190 |
|
| 191 |
Added second forms of cond_wait and cond_timedwait to Perl < 5.8 source filters |
| 192 |
(eliminates segfaults). |
| 193 |
|
| 194 |
Identified and implemented additional internal state conditions when error |
| 195 |
'Cannot detach a joined thread' should occur. |
| 196 |
|
| 197 |
threads->list(threads::all) no longer returns threads that already have a |
| 198 |
thread blocking to join them. |
| 199 |
|
| 200 |
Corrected a few uses of hash and array iterators that modify structure in loop |
| 201 |
(using each() for hashes, separate array copy). |
| 202 |
|
| 203 |
***** Threads API consistency changes ***** |
| 204 |
|
| 205 |
forks::shared now implements standard threads::shared function shared_clone(). |
| 206 |
|
| 207 |
Scalars that have a value and are shared afterwards will retain the shared |
| 208 |
value when running in native threads emulation mode. |
| 209 |
|
| 210 |
Restartable system calls (platform-dependent) and sleep (including Time::HiRes |
| 211 |
sleep, usleep, and nanosleep) should no longer be interrupted by CHLD signal, |
| 212 |
unless CHLD signal handler is defined in user code. This should more accurately |
| 213 |
represent process behavior with slow system calls, as would be expected with |
| 214 |
native ithreads. |
| 215 |
|
| 216 |
Bumped threads $VERSION to 1.71 and threads::shared $VERSION to 1.26 to match |
| 217 |
version-supported features and behavior. |
| 218 |
|
| 219 |
forks::shared share() now correctly checks the function prototype when disabled |
| 220 |
(e.g. when forks::shared is loaded without or before forks). |
| 221 |
|
| 222 |
CLONE method/function is now supported in main:: package (was ignored). |
| 223 |
|
| 224 |
CLONE_SKIP method/function is now supported. |
| 225 |
Usage details at: http://perldoc.perl.org/perl593delta.html#'CLONE_SKIP()' |
| 226 |
|
| 227 |
threads->object(0) now returns undef (main thread is not considered an object). |
| 228 |
|
| 229 |
Support for 'array' context type (alias for already supported 'list' type) when |
| 230 |
creating a new thread. |
| 231 |
|
| 232 |
Thread attempting to join self (while non-detached) returns an error. |
| 233 |
|
| 234 |
Now correctly storing/returning stack size settings, although not internally used |
| 235 |
for anything useful at this time. |
| 236 |
|
| 237 |
Core function rand() is now reseeded in each new thread (via srand()). |
| 238 |
|
| 239 |
***** Miscellaneous changes ***** |
| 240 |
|
| 241 |
Added THREADS_NATIVE_EMULATION environment variable to allow users to have forks |
| 242 |
behave more like native ithreads ("buggy" behaviors and all). |
| 243 |
|
| 244 |
Removed source filter requirement for Perl 5.9+. (Now using internal PL_sharehook |
| 245 |
instead of Attribute::Handlers whenver possible, including with Perl 5.8.x.) |
| 246 |
|
| 247 |
Removed use of AUTOLOAD in forks::shared; may see a minor shared variable access |
| 248 |
performance improvement. |
| 249 |
|
| 250 |
Added signal blocking when doing fork() system call, to insure most reliable |
| 251 |
thread startup behavior (i.e. custom CHLD signal handler won't create instability). |
| 252 |
|
| 253 |
Made minor changes to the test suite to improve descriptions and suppress a few |
| 254 |
unnecessary warnings. |
| 255 |
|
| 256 |
Added internal patching mechanism to allow Test::More to work with Perl |
| 257 |
5.8.1 and older (primarily for test suite backward compatibility). |
| 258 |
|
| 259 |
Silenced spurious Test::More "WOAH! ..." warnings in test suite, regarding Test::More |
| 260 |
being unaware of global test counting when mixing forks and threads. |
| 261 |
|
| 262 |
Added extra parameter error checking to XS code. |
| 263 |
|
| 264 |
Modified internal data manipulation for broadcast() to protect against occasional |
| 265 |
memory corruption with Perl 5.6.x (delete() on array appeared to cause rare segfaults). |
| 266 |
|
| 267 |
Added 'if' CPAN module to package requirements, for Perl 5.6 support (test suite). |
| 268 |
|
| 269 |
Updated to ppport.h 3.14. |
| 270 |
|
| 271 |
0.27 January 27 2008 |
| 272 |
***** Bug fixes ***** |
| 273 |
|
| 274 |
forks::shared now supports perl 5.9.0 and later (with a source filter). The |
| 275 |
requirement for a source filter is hopefully just a temporary solution until |
| 276 |
Attribute::Handlers can access the 'shared' attribute again (which perl 5.9 |
| 277 |
and later currently prevent, perhaps because they consider it a reserved word). |
| 278 |
|
| 279 |
Corrected perl 5.6 support, regarding incompatible XS function Perl prototypes |
| 280 |
(broken since 0.16). |
| 281 |
|
| 282 |
All internal %INC manipulation is now done at compilation (require) time. This |
| 283 |
corrects cases where modules that 'use threads::shared' before forks::shared has |
| 284 |
been loaded actually load ithreads-native threads::shared. |
| 285 |
|
| 286 |
Corrected bug regarding handling forks-server operation deferred signals (which |
| 287 |
was preventing them from being executed when they should be executed). |
| 288 |
|
| 289 |
***** Miscellaneous changes ***** |
| 290 |
|
| 291 |
Forks now uses Perl core module Attribute::Handlers for 'shared' variable |
| 292 |
attribute handling. This also insures compatibility with any other modules |
| 293 |
that may use Attribute::Handlers. |
| 294 |
|
| 295 |
Removed BUS, FPE, ILL, SEGV, and SYS from list of "forks-aware" signal handlers |
| 296 |
for better cross-platform portability. |
| 297 |
|
| 298 |
Added POD strongly encouraging use of forks and forks::shared as FIRST modules. |
| 299 |
|
| 300 |
Now tracking last known CORE::GLOBAL::exit at require time, and resetting at |
| 301 |
END. This should insure that cases where forks wasn't first module to be loaded |
| 302 |
allows for other modules to still use their own custom exit methods. |
| 303 |
|
| 304 |
Moved 5.6.x source filter from forks.pm to forks::shared.pm, where it belongs. |
| 305 |
|
| 306 |
Added appropriate disabled functions (without prototypes) for perl 5.6.x when |
| 307 |
forks::shared is disabled if was loaded without loading forks first). |
| 308 |
|
| 309 |
0.26 September 30 2007 |
| 310 |
***** Bug fixes ***** |
| 311 |
|
| 312 |
Eliminated some warnings on platforms that do not implement all signals forks |
| 313 |
can monitor. |
| 314 |
|
| 315 |
Added boolean hook $forks::DEFER_INIT_BEGIN_REQUIRE to allow external |
| 316 |
modules to override forks server functions if forks loaded in a BEGIN block. |
| 317 |
|
| 318 |
***** Miscellaneous changes ***** |
| 319 |
|
| 320 |
Added some logic in CHLD reapers for better cross-platform stability. |
| 321 |
|
| 322 |
Updated to ppport.h 3.12. |
| 323 |
|
| 324 |
0.25 August 12 2007 |
| 325 |
***** Bug fixes ***** |
| 326 |
|
| 327 |
Updated internal PID tracking to U32 size for increased portability across |
| 328 |
different kernels and kernel configurations. This corrects irregular issues |
| 329 |
with locks on such systems. |
| 330 |
|
| 331 |
Rewrote signal handling engine to be more portable and stable. Changes |
| 332 |
eliminated behavior on BSD kernels that would cause processes to improperly |
| 333 |
exit with an ABRT-triggered core dump. |
| 334 |
|
| 335 |
***** Miscellaneous changes ***** |
| 336 |
|
| 337 |
Added some protections in test suite for non-mixed fork/thread safe |
| 338 |
Test::More module. |
| 339 |
|
| 340 |
Added tests for new signal handling engine. |
| 341 |
|
| 342 |
0.24 July 9 2007 |
| 343 |
***** Threads API consistency changes ***** |
| 344 |
|
| 345 |
Changed $thr->wantarray return value to 0-length string (was string '0') to |
| 346 |
meet standard wantarray scalar context return value. |
| 347 |
|
| 348 |
Added support for exit() and threads->exit() methodology and behavior. |
| 349 |
|
| 350 |
Added support for $thr->error() feature. |
| 351 |
|
| 352 |
Added a warning (and disallowing thread detach) if attempting to detach a |
| 353 |
thread that another thread is currently waiting to join. |
| 354 |
|
| 355 |
***** Internal behavior changes ***** |
| 356 |
|
| 357 |
Added ability to swap primary process (main<->shared) that is parent of all |
| 358 |
processes in threaded application (via $ENV{THREADS_DAEMON_MODEL}); |
| 359 |
should help support co-existance with some fork-aware modules, like POE. |
| 360 |
|
| 361 |
Rewrote signal handling methodology to resolve stability issues with |
| 362 |
inter-thread and external process signaling. |
| 363 |
|
| 364 |
Addressed the limit of 65535 shared variables: you may now create up to |
| 365 |
2^31-1 (2+ billion) shared variables. Note: shared variables are currently |
| 366 |
not memory deallocated even if they go out of scope in all threads; thus, |
| 367 |
it's NOT recommended to create too many (1k+) unless you have a requirement |
| 368 |
to do so. Shared var mem deallocation (when no longer referenced by any |
| 369 |
thread) will be addressed in a future release. |
| 370 |
|
| 371 |
Improved behavior of signal() and scope-exit unlock ordinal to insure that |
| 372 |
all threads, no matter what type of waiting they were performing, have an |
| 373 |
equal chance to receive the signal or re-acquire the lock. The old behavior |
| 374 |
gave preference towards regular waiting events for signal, and timedwaiting |
| 375 |
events waiting to reacquire the lock for unlock ordinal. |
| 376 |
|
| 377 |
Deprecated and removed deadlock detection 'resolve_signal' feature (as this |
| 378 |
could not be supported in new forks.pm signal handling logic). |
| 379 |
|
| 380 |
***** Bug fixes ***** |
| 381 |
|
| 382 |
Shared variable in push() on shared array now works. |
| 383 |
|
| 384 |
Eliminated slow memory leak when creating many joinable threads: the shared |
| 385 |
process now reclaims all shared memory allocated for joinable threads, as |
| 386 |
long as the application (periodically) joins then after they complete. |
| 387 |
|
| 388 |
Eliminated "Performing cleanup for dead thread 0" errors when compiling |
| 389 |
a script (i.e. perl -c script.pl). This fix also eliminates double |
| 390 |
"syntax OK" reports when compiling a script. |
| 391 |
|
| 392 |
Fixed a case where detach after thread had already completed could result |
| 393 |
in incorrect thread group exit state reporting. |
| 394 |
|
| 395 |
Corrected a bug regarding recursive variable unlocking (was deleting |
| 396 |
instead of decrementing lock count). |
| 397 |
|
| 398 |
Fixed a few issues in test scripts regarding mis-reported errors related to |
| 399 |
older threads.pm installs or non-threaded Perl targets. |
| 400 |
|
| 401 |
Forks now starts correctly if called with 'require' or if forks::import |
| 402 |
is skipped for any reason. |
| 403 |
|
| 404 |
Added additional check in server to shutdown if main thread dies in a hard |
| 405 |
way (no notification to server or thread group). |
| 406 |
|
| 407 |
Added some extra protection in thread signaling (to insure that process |
| 408 |
exists before signaling it). |
| 409 |
|
| 410 |
Added some protection in test suite for issues with race-conditions in |
| 411 |
Test::More. |
| 412 |
|
| 413 |
Fixed race condition in forks07.t that could cause test to report an error. |
| 414 |
|
| 415 |
Fixed race issue in forks04.t that could cause script to error out on |
| 416 |
Perl instances with old native threads.pm libraries or no threads.pm |
| 417 |
library. |
| 418 |
|
| 419 |
|
| 420 |
***** Miscellaneous changes ***** |
| 421 |
|
| 422 |
Added additional thread environment protection regarding fork occuring |
| 423 |
outside forks.pm module. Also silenced a few warnings that might have |
| 424 |
occured in such cases. |
| 425 |
|
| 426 |
Silenced a few more unnecessary run-time warnings in specific exception |
| 427 |
and error cases. |
| 428 |
|
| 429 |
Rewrote END behavior for more stability and better cleanup during thread |
| 430 |
(process) group exit. |
| 431 |
|
| 432 |
Added internal hooks to allow external modules to override default forks.pm |
| 433 |
fork logic. This should allow more flexibility to integrate forks with |
| 434 |
application-scope modifying environments (i.e. mod_perl, POE, Coro, etc.). |
| 435 |
|
| 436 |
Removed dependency on Reaper module. |
| 437 |
|
| 438 |
Updated version requirement for Scalar::Util module. |
| 439 |
|
| 440 |
Upgraded to ppport.h 3.11. |
| 441 |
|
| 442 |
Fixed some XS portability issues with older versions of Perl (5.8.1 and older). |
| 443 |
|
| 444 |
0.23 8 April 2007 |
| 445 |
***** Test suite fixes ***** |
| 446 |
|
| 447 |
Corrected issue in forks04.t that would cause irrelevant but terminal |
| 448 |
compilation errors if real threads.pm (1.34 or later) weren't present. |
| 449 |
|
| 450 |
***** Miscellaneous changes ***** |
| 451 |
|
| 452 |
Silenced a warning during external fork (non-thread) process exit. |
| 453 |
|
| 454 |
Added some internal hooks to allow add-on modules (e.g. forks::BerkeleyDB) |
| 455 |
the opportunity to clean up global thread resources during shutdown. |
| 456 |
|
| 457 |
0.22 19 March 2007 |
| 458 |
***** Internal behavior changes ***** |
| 459 |
|
| 460 |
Thread manager process now forcefully kills any still active threads |
| 461 |
when it exits. This is intended to best simulate standard thread.pm |
| 462 |
thread cleanup during process exit. |
| 463 |
|
| 464 |
***** Bug fixes ***** |
| 465 |
|
| 466 |
Corrected bug in shared server shutdown preventing complete cleanup. |
| 467 |
|
| 468 |
Corrected some platform and perl build sensitivities in the test suite. |
| 469 |
|
| 470 |
***** Miscellaneous changes ***** |
| 471 |
|
| 472 |
Added additional stability against fork() outside of forks.pm. |
| 473 |
|
| 474 |
Tweaked some warnings and disabled some debug logging. |
| 475 |
|
| 476 |
0.21 17 March 2007 |
| 477 |
This revision includes *many* core changes and improvements, so be sure |
| 478 |
to perform full testing with existing forks-enabled applications before |
| 479 |
upgrading. |
| 480 |
|
| 481 |
All changes have been exposed to extensive regression testing, so you may |
| 482 |
expect all new features to be reasonably stable unless otherwise noted |
| 483 |
with a *WARNING* tag. |
| 484 |
|
| 485 |
|
| 486 |
***** New features ***** |
| 487 |
|
| 488 |
Enabled complete thread context support. Be sure to specify the context, |
| 489 |
either implicit or directly. This also means you may not get what you |
| 490 |
expect if you return values in a context that doesn't match your spec. |
| 491 |
|
| 492 |
Add optional, automatic deadlock detection (warnings) in threads::shared. |
| 493 |
Also added is_deadlocked() method (manual deadlock detection) for threads. |
| 494 |
|
| 495 |
Added set_deadlock_option class method to forks::shared (threads::shared). |
| 496 |
|
| 497 |
Aware of thread params at thread creation, e.g. threads->new({}, sub {}); |
| 498 |
|
| 499 |
Added complete support for $thr->wantarray and thread->wantarray. |
| 500 |
|
| 501 |
Added complete support for thread state: is_running, is_joinable, |
| 502 |
is_detached(). |
| 503 |
|
| 504 |
Added additional support to threads->list(), with package variables: |
| 505 |
threads::all, threads::running, and threads::joinable. |
| 506 |
|
| 507 |
Added support for 'use forks qw(stringify)'where the TID is returned |
| 508 |
for a threads object in string context. |
| 509 |
|
| 510 |
Added detailed last known state of all threads on main thread exit (or |
| 511 |
server process unexpected exit), like: |
| 512 |
Perl exited with active threads: |
| 513 |
x running and unjoined |
| 514 |
y finished and unjoined |
| 515 |
z running and detached |
| 516 |
|
| 517 |
Added stubs for get_stack_size and set_stack_size, although they don't |
| 518 |
do anything (yet). |
| 519 |
|
| 520 |
Added support for threads->_handle and $thr->_handle, although it |
| 521 |
currently does not guarantee a reference to the same memory address |
| 522 |
each time (will be addressed in a later release). |
| 523 |
|
| 524 |
Added support for inter-thread signaling using $thr->kill('SIG...'). |
| 525 |
*WARNING* This feature is still highly experimental and has known |
| 526 |
issues when sending a signal to a process sending or receiving socket |
| 527 |
data pertaining to a threads operation. This will be addressed in |
| 528 |
a future release. |
| 529 |
|
| 530 |
Added question during build process to allow forks to override threads |
| 531 |
namespace if target Perl does not have native threading built in. |
| 532 |
Added POD describing this feature and behavior implications. |
| 533 |
|
| 534 |
|
| 535 |
***** Bug fixes ***** |
| 536 |
|
| 537 |
Corrected bug in threads::shared::scalar that prevented tieing without |
| 538 |
a pre-existing scalar reference. |
| 539 |
|
| 540 |
Localizing $? in END block to insure that main thread exit code isn't |
| 541 |
accidentally overwritten during shutdown. |
| 542 |
|
| 543 |
Corrected several cases where internal auto-vivification was not intended, |
| 544 |
but might cause internal variable state issues. |
| 545 |
|
| 546 |
Corrected bug where fork() followed by ->isthread() in a child process |
| 547 |
while parent process (a thread) was already waiting on a separate thread |
| 548 |
could cause internal synchronization issues. |
| 549 |
|
| 550 |
Corrected bug in ->list where scalar context would return last object, |
| 551 |
not the number of waiting threads. |
| 552 |
|
| 553 |
Added additional protection in END block against external fork() occuring |
| 554 |
outside our knowledge causing synchronization havoc with the thread process |
| 555 |
group. |
| 556 |
|
| 557 |
Removed delete from %DETACHED on thread exit, as this property is used for |
| 558 |
internal thread type and state checking. |
| 559 |
|
| 560 |
Updated some error handling to suppress some undefined variable warnings. |
| 561 |
|
| 562 |
|
| 563 |
***** Internal behavior improvements ***** |
| 564 |
|
| 565 |
Added silent overload of Config.pm 'useithreads' property to insure all |
| 566 |
modules and scripts see a true value when forks is loaded. |
| 567 |
|
| 568 |
Added explicit signal trapping of all untrapped normal and error signals |
| 569 |
for consistent and safe thread exit behavior. |
| 570 |
|
| 571 |
Added defensive error handling around non-blocking server sockets to |
| 572 |
protect against interruptions or busy resources during read or write. |
| 573 |
This should also make UNIX socket support more stable on certain target |
| 574 |
architectures. |
| 575 |
|
| 576 |
Added defensive logic to cleanup internal resources for threads that |
| 577 |
appear to have exited in an unsafe manner (and that may have left |
| 578 |
forks::shared resources in a unclean state) or were terminated with SIGKILL. |
| 579 |
|
| 580 |
Rewrote _length(), _send(), and _receive() internal functions to protect |
| 581 |
against signal interruptions, busy resources, socket disconnections, full |
| 582 |
socket buffers, and miscellaneous socket errors, including adding retry |
| 583 |
logic where appropriate. |
| 584 |
|
| 585 |
Updated _join() server function with much more intelligent logic regarding |
| 586 |
the state of a thread during the join process and a few more error cases |
| 587 |
that it needed to check for. |
| 588 |
|
| 589 |
threads->yield() now does a 1 ms sleep. |
| 590 |
|
| 591 |
|
| 592 |
***** Threads API consistency changes ***** |
| 593 |
|
| 594 |
Can now signal unlocked variable using cond_signal and cond_broadcast. |
| 595 |
Note: Signaling locked returns 1; signaling unlocked returns undef. |
| 596 |
|
| 597 |
Modified lock, cond_signal, and cond_broadcast to return undef (instead |
| 598 |
of 1) to be consistent with threads.pm. |
| 599 |
|
| 600 |
Overloaded != for thread objects. |
| 601 |
|
| 602 |
A failed thread spawn (fork) now prints a warning and returns undef |
| 603 |
instead of dieing out. |
| 604 |
|
| 605 |
Detach twice on the same thread now throws an error. |
| 606 |
|
| 607 |
Improved format and content of internal warnings, and warnings now |
| 608 |
respect warnings state in caller for category 'threads'. |
| 609 |
|
| 610 |
Bumped threads $VERSION to 1.26, threads::shared to 1.04 to match |
| 611 |
version-supported features and behavior. |
| 612 |
|
| 613 |
|
| 614 |
*** Miscellaneous changes *** |
| 615 |
|
| 616 |
Implemented initial framework for better message handling. This should |
| 617 |
help reduce overall CPU usage, and hopefully improve performance, using |
| 618 |
custom filter definition for request and response messages that do not |
| 619 |
require Storable freeze/thaw. Requests that currently implement this |
| 620 |
are: _lock and _unlock. Responses that currently implement this are: |
| 621 |
any generic boolean response. |
| 622 |
|
| 623 |
Made Time::HiRes a prerequisite now. This means that fractional |
| 624 |
cond_timedwait is now supported by default. |
| 625 |
|
| 626 |
Optimized sigset masking: now only one set is created at compile time |
| 627 |
and reused during execution. |
| 628 |
|
| 629 |
Now safely runs in taint mode when any potentially tainted environment |
| 630 |
vars are defined. |
| 631 |
|
| 632 |
Suppressing unnecessary warnings in the case that 'test' does not exist |
| 633 |
in /bin or /usr/bin. |
| 634 |
|
| 635 |
Silenced thread socket errors during thread shutdown process, unless |
| 636 |
debugging is enabled. |
| 637 |
|
| 638 |
Added basic blocking join poll checks, to help prevent against forever |
| 639 |
blocking join() cases in abnormal thread death circumstances. |
| 640 |
|
| 641 |
Thread shutdown now expects a response (to insure synchronized shutdown |
| 642 |
agreement with server process). |
| 643 |
|
| 644 |
General improvements in thread shutdown stability (primarily server-side). |
| 645 |
|
| 646 |
0.20 5 October 2006 |
| 647 |
Fixed rare thread start race condition where parent thread would block |
| 648 |
indefinitely if child thread were to spawn, complete, and exit before |
| 649 |
the parent could obtain the TID associated with the child thread. |
| 650 |
|
| 651 |
Corrected a few cases in server timedwait handling, cond_broadcast, |
| 652 |
and cond_signal where a lock could be prematurely transferred to |
| 653 |
another thread if the main thread (tid 0) were holding the lock at |
| 654 |
the time the event expired. |
| 655 |
|
| 656 |
Modified cond_timedwait to support fractional seconds (if Time::HiRes |
| 657 |
is loaded before forks). |
| 658 |
|
| 659 |
Minor changes to forks.xs for backwards compatibility with gcc 2.96. |
| 660 |
|
| 661 |
Minor cleanup in (forks.xs) bless reference handling. |
| 662 |
|
| 663 |
When using INET sockets, peer address is validated against the loopback |
| 664 |
address (IPv4 127.0.0.1) before accepting the connection; otherwise, |
| 665 |
socket is immediately closed and a warning is emitted. |
| 666 |
|
| 667 |
Added THREADS_IP_MASK env param to allow override of default IP mask |
| 668 |
filter. |
| 669 |
|
| 670 |
Misc cleanup of internal server environment variable handling. |
| 671 |
|
| 672 |
Moved some server code into separate subroutines. |
| 673 |
|
| 674 |
0.19 21 May 2006 |
| 675 |
Implemented an exported bless() function allow transparent bless() |
| 676 |
across threads with forks::shared. |
| 677 |
|
| 678 |
Implemented exported is_shared function in forks::shared. |
| 679 |
|
| 680 |
Implemented custom CHLD signal handler to cleanup zombie process. |
| 681 |
This change was introduced to resolve an issue on some platforms |
| 682 |
where using $SIG{CHLD}='IGNORE' resulted in the perl core system() |
| 683 |
function returning -1 instead of the exit code of the system call. |
| 684 |
This signal handler is only used if the target system's system() |
| 685 |
call returns -1 on success when $SIG{CHLD}='IGNORE'. |
| 686 |
|
| 687 |
Added THREADS_SIGCHLD_IGNORE to allow users to force forks to use |
| 688 |
$SIG{CHLD}='IGNORE' on systems where a custom CHLD signal handler |
| 689 |
is automatically installed to support correct exit code of perl |
| 690 |
core system() function. |
| 691 |
|
| 692 |
Added THREADS_NICE env param to allow user to adjust forks.pm server |
| 693 |
process POSIX::nice value when running as root. If unset, no change |
| 694 |
is made to the server process priority. This differs from the |
| 695 |
historical behavior of forks.pm defaulting to nice -19 when run as |
| 696 |
root. |
| 697 |
|
| 698 |
Patched XS code to be ANSI C86 compliant (again). Code was unintentionally |
| 699 |
changed to require a minimum of ANSI C89 compliance since 0.17. This |
| 700 |
should allow all gcc 2.95.x and other C86-compliant compilers to once |
| 701 |
again build forks.pm. |
| 702 |
|
| 703 |
Fixed prototype mismatch warning when disabling cond_wait when forks |
| 704 |
is not used before forks::shared. |
| 705 |
|
| 706 |
Added patch to quietly ignore sharing an already shared variable. |
| 707 |
forks::shared used to bombs out in such cases (e.g. $a:shared; share($a);). |
| 708 |
|
| 709 |
Updated to ppport.h 3.06. |
| 710 |
|
| 711 |
Implemented separate package versions for forks and threads. threads |
| 712 |
package version will represent the most recent threads.pm release that |
| 713 |
this module is functionally compatible with. |
| 714 |
|
| 715 |
Disabled call to server process on shared variable DESTROY calls to |
| 716 |
decrease server communication load, as none of the affected TIE classes |
| 717 |
implement custom DESTROY methods. |
| 718 |
|
| 719 |
0.18 7 December 2005 |
| 720 |
Introduction of UNIX socket support. Socket descriptors are written |
| 721 |
to /var/tmp and given rw access by all by default for best support |
| 722 |
on multi-user systems. |
| 723 |
|
| 724 |
Importing SOMAXCONN and using for socket server listener max socket |
| 725 |
connections (was hard coded at 10) for best (and system-level flexible) |
| 726 |
thread spawn stability under high load. |
| 727 |
|
| 728 |
0.17 14 May 2005 (unreleased) |
| 729 |
Added method cond_timedwait and added second forms of cond_wait and |
| 730 |
cond_timedwait per the ithread specification (where signal var |
| 731 |
differs from lock var). All elements of perl ithread interface are |
| 732 |
now implemented, with respect to perl 5.8.7. |
| 733 |
|
| 734 |
Added eval wrapper around new thread code execution to trap die |
| 735 |
events; thus, join() is now more robust (fewer chances for runtime |
| 736 |
hangs on '$thread->join' due to premature child thread termination). |
| 737 |
|
| 738 |
Fixed bug in _islocked in case where if main thread tried to unlock |
| 739 |
an already unlocked variable, it would not correctly enter if case |
| 740 |
and return undef or croak() due to undef value in @LOCKED resolving |
| 741 |
to numeric 0. |
| 742 |
|
| 743 |
0.16 8 April 2004 |
| 744 |
Changed semantics of debugging function: must now specify environment |
| 745 |
variable THREADS_DEBUG to be able to enable and disable debugging. |
| 746 |
If the environment variable does not exist at compile time, then all |
| 747 |
of the debugging code is optimised away. So performance in production |
| 748 |
environments should be better than before. |
| 749 |
|
| 750 |
29 March 2004 |
| 751 |
Goto &sub considered evil with regards to performance and memory |
| 752 |
leaking. Therefore removed goto's where appropriate. |
| 753 |
|
| 754 |
0.15 14 January 2004 |
| 755 |
Just got too much mail from people attempting to use forks.pm on |
| 756 |
Windows. Decided to add check for Win32 to Makefile.PL to have it |
| 757 |
die when attempting to run on Windows. Added documentation to |
| 758 |
explain this. |
| 759 |
|
| 760 |
0.14 7 January 2004 |
| 761 |
Removed dependency on load.pm: it really doesn't make sense in a |
| 762 |
forked environment: I don't know what I was thinking in that respect. |
| 763 |
|
| 764 |
Added dependency on IO::Socket 1.18: we do need auto-flushing sockets |
| 765 |
(which seems to be pretty standard nowadays, but just to make sure). |
| 766 |
|
| 767 |
Fixed problem with large values / structures being passed with some |
| 768 |
help from Jan-Pieter Cornet at the Amsterdam PM Meeting. Spotted by |
| 769 |
Paul Golds. Added test for it. |
| 770 |
|
| 771 |
0.13 4 January 2004 |
| 772 |
Looked at fixing the problem with signalling unlocked variables. |
| 773 |
Unfortunately, there does not seem to be a quick solution. Need to |
| 774 |
abandon this idea right now until I have more time. Updated |
| 775 |
documentation to let the world know there is an inconsistency. |
| 776 |
|
| 777 |
Documented the THREADS_DEBUG environment variable and made sure it is |
| 778 |
unset during testing. |
| 779 |
|
| 780 |
Updated ppport.h to 2.009. Didn't expect any problems with 5.8.1, |
| 781 |
but you never know. |
| 782 |
|
| 783 |
0.12 2 January 2004 |
| 784 |
Fixed problem with signalling thread 0. Spotted by Stephen Adkins. |
| 785 |
|
| 786 |
0.11 28 December 2003 |
| 787 |
Added automatic required modules update using Devel::Required. |
| 788 |
|
| 789 |
Added requirement for Devel::Required, so that optional modules |
| 790 |
are listed as required on the appropriate systems. |
| 791 |
|
| 792 |
0.10 11 November 2003 |
| 793 |
Added check for processes dieing at the length check of a message. |
| 794 |
Not 100% sure whether this will be the best way to handle the main |
| 795 |
thread dieing, e.g. when it exits before all threads have been |
| 796 |
joined. |
| 797 |
|
| 798 |
0.09 24 October 2003 |
| 799 |
Apparently, Test::Harness cannot handle testing "threaded" scripts |
| 800 |
using an unthreaded Perl. Added test for threadedness of the Perl |
| 801 |
being used: if so, skips testing Thread::Queue. Spotted by several |
| 802 |
CPAN testers. |
| 803 |
|
| 804 |
0.08 24 October 2003 |
| 805 |
Shared entities that were also blessed as an object, were not |
| 806 |
correctly handled (ref() versus Scalar::Util::reftype() ). Spotted |
| 807 |
by Jack Steadman. Now fixed by using reftype() rather than ref(). |
| 808 |
|
| 809 |
Dependency on Scalar::Util added (not sure when that became core). |
| 810 |
Added tests to excercise Thread::Queue (if available). |
| 811 |
|
| 812 |
10 October 2003 |
| 813 |
Changed async() to make it a little faster by removing an extra call |
| 814 |
from the stack. |
| 815 |
|
| 816 |
0.07 27 September 2003 |
| 817 |
Added error detection in case lock or cond_xxx were called on unshared |
| 818 |
variables or cond_xxx were called on an unlocked variable. Added tests |
| 819 |
for it in the test-suite. |
| 820 |
|
| 821 |
Added dummy package declaration to forks::shared.pm for CPAN's sake. |
| 822 |
Cleaned up the attribute handler code in forks::shared.pm a bit. |
| 823 |
|
| 824 |
0.06 27 September 2003 |
| 825 |
Finally grokked the documentation about attributes. This allowed me |
| 826 |
to finally write the handler for the ":shared" attribute. Which in |
| 827 |
the end turned out to be surprisingly simple. |
| 828 |
|
| 829 |
Adapted the test-suite to test usage of the ":shared" attribute as |
| 830 |
opposed to sharing variables with the "share" subroutine. |
| 831 |
|
| 832 |
0.05 26 September 2003 |
| 833 |
Increased dependency on load.pm to 0.11: versions of load.pm before |
| 834 |
that had issues with running under taint. |
| 835 |
|
| 836 |
Debug statements can now be activated by setting the environment |
| 837 |
variable THREADS_DEBUG to true. As this is still experimental, this |
| 838 |
feature is only described in the CHANGELOG for now. |
| 839 |
|
| 840 |
Fixed several issues when running under taint. Test-suite now runs |
| 841 |
in tainted mode just to be on the safe side. |
| 842 |
|
| 843 |
Removed some debug statements from the test-suite. |
| 844 |
|
| 845 |
0.04 10 August 2003 |
| 846 |
Implemented .xs file munging and source-filter to be able to truly |
| 847 |
support forks.pm under Perl 5.6.x. Thanks to Juerd Waalboer for the |
| 848 |
idea of the source filter. |
| 849 |
|
| 850 |
It is now confirmed that forks.pm won't work under 5.005, so the |
| 851 |
minimum version of Perl is now set to 5.6.0 in the Makefile.PL. |
| 852 |
|
| 853 |
7 August 2003 |
| 854 |
Tested under 5.8.1-RC4. The WHOA! messags seem to have disappeared |
| 855 |
but instead a warning has appeared that cannot be suppressed. This |
| 856 |
was caused by my attempt to activate the :shared attribute. Since |
| 857 |
that doesn't work anyway, I removed the offending code and the |
| 858 |
warning went away. |
| 859 |
|
| 860 |
Fixed some warnings in the test-suite. |
| 861 |
|
| 862 |
Fixed another warning in forks.pm. Reported by Bradley W. Langhorst. |
| 863 |
|
| 864 |
0.03 2 April 2003 |
| 865 |
Fixed a warning in forks.pm. Reported by Bradley W. Langhorst. |
| 866 |
|
| 867 |
0.02 17 January 2003 |
| 868 |
Added dummy -package forks- to forks.pm to fool CPAN into thinking |
| 869 |
it really is the forks.pm module, when in fact it is of course |
| 870 |
threads.pm. |
| 871 |
|
| 872 |
Fixed some warnings in t/forks01.t. |
| 873 |
|
| 874 |
28 October 2002 |
| 875 |
Made sure length packing uses Network order. |
| 876 |
|
| 877 |
0.01 27 October 2002 |
| 878 |
First public version of forks.pm. Thanks to Lars Fenneberg for all |
| 879 |
the help so far. |