Changeset 20091 for docs/Perl6/Spec
- Timestamp:
- 03/09/08 23:18:55 (9 months ago)
- Files:
-
- 1 modified
-
docs/Perl6/Spec/Concurrency.pod (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
docs/Perl6/Spec/Concurrency.pod
r20085 r20091 300 300 =head1 Threads 301 301 302 All outside of a thread defined variables are 303 shared and transactional variables by default 304 305 Program will wait for _all_ threads. 306 Unjoined threads will be joined at the beginning of the END 307 block batch of the parent thread that spawned them 308 302 309 =head2 Thread creation 303 310 … … 311 318 312 319 313 =head2 Thread attributes320 =head2 Thread status and attributes 314 321 315 322 =over … … 341 348 342 349 the CC currently running in that thread 350 351 352 =item wake_on_readable, wake_on_writable, wake_on 353 354 TODO: IO objects and containers gets concurrency love! 355 356 - $obj.wake_on_either_readable_or_writable_or_passed_time(3); # fixme fixme 357 - $obj.wake_on:{.readable} # busy wait, probably 358 359 my @a is Array::Chan = 1..Inf; 360 async { @a.push(1) }; 361 async { @a.blocking_shift({ ... }) }; 362 async { @a.unshift({ ... }) }; 363 343 364 344 365 =back … … 437 458 438 459 =back 439 440 =head2 Thread status441 442 -IO objects and containers gets concurrency love!443 - $obj.wake_on_readable444 - $obj.wake_on_writable445 - $obj.wake_on_either_readable_or_writable_or_passed_time(3); # fixme fixme446 - $obj.wake_on:{.readable} # busy wait, probably447 448 my @a is Array::Chan = 1..Inf;449 async { @a.push(1) };450 async { @a.blocking_shift({ ... }) };451 async { @a.unshift({ ... }) };452 453 Communication abstractions454 - shared, transactional variables by default455 456 # program will wait for _all_ threads457 # unjoined threads will be joined at the beginning of the END block batch458 # of the parent thread that spawned them459 460 460 461 … … 608 609 609 610 foo(4); # and that's all she wrote 610 611 # If you don't want your variables to get rebound, use "is copy":612 coro foo ($x is copy) {...}613 # which is sugar for614 coro foo ($x) {615 {616 my $x := $OUTER::x;617 ...;618 # Further calls of &foo rebound $OUTER::x, not $x.619 }620 }621 611 622 612 sub foo {
