| 296 | | =item TODO |
| 297 | | |
| 298 | | - numify to TIDs (as in pugs) |
| 299 | | - stringify to something sensible (eg. "<Conc:tid=5>"); |
| 300 | | - enumerable with Conc.list |
| 301 | | - Conc.yield (if this is to live but deprecated, maybe call it sleep(0)?) |
| 302 | | - sleep() always respects other threads, thank you very much |
| 303 | | - standard methods: |
| 304 | | - .join # wait for invocant to finish (always item cxt) |
| 305 | | - .die # throw exception in the invocant thread |
| 306 | | - .alarm # set up alarms |
| 307 | | - .alarms # query existing alarms |
| 308 | | - .suspend # pause a thread; fail if already paused |
| 309 | | - .resume # revive a thread; fail if already running |
| 310 | | - .detach # survives parent thread demise (promoted to process) |
| 311 | | # process-local changes no longer affects parent |
| 312 | | # tentatively, the control methods still applies to it |
| 313 | | # including wait (which will always return undef) |
| 314 | | # also needs to discard any atomicity context |
| 315 | | - attributes: |
| 316 | | - .started # time |
| 317 | | - .finished # time |
| 318 | | - .waiting # suspended (not diff from block on wakeup signal) |
| 319 | | # waiting on a handle, a condition, a lock, et cetera |
| 320 | | # otherwise returns false for running threads |
| 321 | | # if it's finished then it's undef(?) |
| 322 | | - .current_continuation |
| 323 | | # the CC currently running in that thread |
| 324 | | |
| 325 | | - "is throttled" trait |
| | 325 | =item started |
| | 326 | |
| | 327 | start time |
| | 328 | |
| | 329 | =item finished |
| | 330 | |
| | 331 | end time |
| | 332 | |
| | 333 | =item waiting |
| | 334 | |
| | 335 | suspended (not diff from block on wakeup signal) |
| | 336 | waiting on a handle, a condition, a lock, et cetera |
| | 337 | otherwise returns false for running threads |
| | 338 | if it's finished then it's undef(?) |
| | 339 | |
| | 340 | =item current_continuation |
| | 341 | |
| | 342 | the CC currently running in that thread |
| | 343 | |
| | 344 | =back |
| | 345 | |
| | 346 | =head2 Thread operators |
| | 347 | |
| | 348 | =over |
| | 349 | |
| | 350 | =item Stringify |
| | 351 | |
| | 352 | Stringify to something sensible (eg. "<Conc:tid=5>"); |
| | 353 | |
| | 354 | my $thr = async { ... }; |
| | 355 | say ~$thr; |
| | 356 | |
| | 357 | =item Numerify |
| | 358 | |
| | 359 | Numify to TIDs (as in pugs) |
| | 360 | |
| | 361 | my $thr = async { ... }; |
| | 362 | say +$thr; |
| | 363 | |
| | 364 | =item Enumerable |
| | 365 | |
| | 366 | TODO: Enumerable with Conc.list |
| | 367 | |
| | 368 | =back |
| | 369 | |
| | 370 | =head2 Thread methods |
| | 371 | |
| | 372 | =over |
| | 373 | |
| | 374 | =item yield |
| | 375 | |
| | 376 | TODO: Conc.yield (if this is to live but deprecated, maybe call it sleep(0)?) |
| | 377 | |
| | 378 | =item sleep |
| | 379 | |
| | 380 | sleep() always respects other threads, thank you very much |
| | 381 | |
| | 382 | =item join |
| | 383 | |
| | 384 | wait for invocant to finish (always item cxt) |
| | 385 | |
| | 386 | my $thr = async { ... }; |
| | 387 | $thr.join(); |
| | 388 | |
| | 389 | =item die |
| | 390 | |
| | 391 | throw exception in the invocant thread |
| | 392 | |
| | 393 | =item alarm |
| | 394 | |
| | 395 | set up alarms |
| | 396 | |
| | 397 | =item alarms |
| | 398 | |
| | 399 | query existing alarms |
| | 400 | |
| | 401 | =item suspend |
| | 402 | |
| | 403 | pause a thread; fail if already paused |
| | 404 | |
| | 405 | =item resume |
| | 406 | |
| | 407 | revive a thread; fail if already running |
| | 408 | |
| | 409 | =item detach |
| | 410 | |
| | 411 | survives parent thread demise (promoted to process) |
| | 412 | process-local changes no longer affects parent |
| | 413 | tentatively, the control methods still applies to it |
| | 414 | including wait (which will always return undef) |
| | 415 | also needs to discard any atomicity context |
| | 416 | |
| | 417 | =item "is throttled" trait |
| | 418 | |
| | 419 | TODO: |