Name

SPVM::Thread - Native Thread

Usage

use Thread;

my $results = [0];
my $thread = Thread->new([$results : int[]] method : void () {
  $results->[0] = 5;
});

$thread->join;

Description

The Thread class has methods to create native threads.

This class is a binding of std::thread in C++.

Class Methods

static method new : Thread ($task : Callback);

Creates a new native thread and run the task $task on it.

And creates a new Thread object and returns it.

Instance Methods

join

method join : void ();

Waits for the thread to finish.

get_id

method get_id : Thread::ID ();

Gets the thread ID.

Repository

SPVM::Thread - Github

See Also

Author

Yuki Kimoto kimoto.yuki@gmail.com

Copyright & License

Copyright 2022-2022 Yuki Kimoto, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.