Thread.pm

filter: Statementstmt 100% 2 / 2 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 2 / 2 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« Thread/ThisThread.pm ↑ Summary
1 package SPVM::Thread;
2  
3 1 our $VERSION = "0.011";
4  
5 1 1;
6  
7 =head1 Name
8  
9 SPVM::Thread - Native Thread
10  
11 =head1 Description
12  
13 Thread class in L<SPVM> manipulates native threads.
14  
15 This class is a binding of L<std::thread in C++|https://en.cppreference.com/w/cpp/thread/thread>.
16  
17 =head1 Usage
18  
19 use Thread;
20
21 my $results = [0];
22 my $thread = Thread->new([$results : int[]] method : void () {
23 $results->[0] = 5;
24 });
25
26 $thread->join;
27  
28 =head1 Fields
29  
30 =head2 task
31  
32 C<has task : L<Callback|SPVM::Callback>;>
33  
34 A task exceuted by a thread.
35  
36 =head2 caller_info
37  
38 C<has caller_info : L<CallerInfo|SPVM::CallerInfo>;>
39  
40 Thead caller information.
41  
42 =head1 Class Methods
43  
44 C<static method new : L<Thread|SPVM::Thread> ($task : L<Callback|SPVM::Callback>);>
45  
46 Creates a new native thread and run the task $task on it.
47  
48 And creates a new L<Thread|SPVM::Thread> object and returns it.
49  
50 =head1 Instance Methods
51  
52 =head2 join
53  
54 C<method join : void ();>
55  
56 Waits for the thread to finish.
57  
58 =head2 get_id
59  
60 C<method get_id : L<Thread::ID|SPVM::Thread::ID> ();>
61  
62 Gets the thread ID.
63  
64 =head1 Repository
65  
66 L<SPVM::Thread - Github|https://github.com/yuki-kimoto/SPVM-Thread>
67  
68 =head2 See Also
69  
70 =over 2
71  
72 =item * L<Thread::ThisThread|SPVM::Thread::ThisThread>
73  
74 =item * L<Thread::ID|SPVM::Thread::ID>
75  
76 =item * L<std::thread in C++|https://en.cppreference.com/w/cpp/thread/thread>
77  
78 =back
79  
80 =head1 Author
81  
82 Yuki Kimoto C<kimoto.yuki@gmail.com>
83  
84 =head1 Copyright & License
85  
86 Copyright 2022-2022 Yuki Kimoto, all rights reserved.
87  
88 This program is free software; you can redistribute it and/or modify it
89 under the same terms as Perl itself.
90  
« Thread/ThisThread.pm ↑ Summary