| 1 | package SPVM::Sync::Mutex; | ||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | 1; | ||
| 6 | |||
| 7 | =head1 Name | ||
| 8 | |||
| 9 | SPVM::Sync::Mutex - Mutex | ||
| 10 | |||
| 11 | =head1 Description | ||
| 12 | |||
| 13 | The Sync::Mutex class in L<SPVM> has methods to manipulate mutex. | ||
| 14 | |||
| 15 | =head1 Usage | ||
| 16 | |||
| 17 | use Sync::Mutex; | ||
| 18 | |||
| 19 | my $mutex = Sync::Mutex->new; | ||
| 20 | |||
| 21 | $mutex->lock; | ||
| 22 | |||
| 23 | $mutex->unlock; | ||
| 24 | |||
| 25 | =head1 Class Methods | ||
| 26 | |||
| 27 | C<static method new : L<Sync::Mutex|SPVM::Sync::Mutex> ();> | ||
| 28 | |||
| 29 | Creates a new L<Sync::Mutex|SPVM::Sync::Mutex> object, initializes it by calling the L<new_instance|SPVM::Document::NativeAPI::Mutex/"new_instance"> mutex native API, and returns it. | ||
| 30 | |||
| 31 | =head1 Instance Methods | ||
| 32 | |||
| 33 | =head2 DESTROY | ||
| 34 | |||
| 35 | C<method DESTROY : void ();> | ||
| 36 | |||
| 37 | Destroys this instance by calling the L<free_instance|SPVM::Document::NativeAPI::Mutex/"free_instance"> mutex native API | ||
| 38 | |||
| 39 | =head2 lock | ||
| 40 | |||
| 41 | C<method lock : void ();> | ||
| 42 | |||
| 43 | Locks this mutex by calling the L<lock|SPVM::Document::NativeAPI::Mutex/"lock"> mutex native API. | ||
| 44 | |||
| 45 | =head2 unlock | ||
| 46 | |||
| 47 | C<method unlock : void ();> | ||
| 48 | |||
| 49 | UnLocks this mutex by calling the L<unlock|SPVM::Document::NativeAPI::Mutex/"unlock"> mutex native API. | ||
| 50 | |||
| 51 | =head2 reader_lock | ||
| 52 | |||
| 53 | C<method reader_lock : void ();> | ||
| 54 | |||
| 55 | Locks this mutex for reading by calling the L<reader_lock|SPVM::Document::NativeAPI::Mutex/"reader_lock"> mutex native API. | ||
| 56 | |||
| 57 | =head2 reader_unlock | ||
| 58 | |||
| 59 | C<method reader_unlock : void ();> | ||
| 60 | |||
| 61 | UnLocks this mutex locked by L</"reader_lock"> method by calling the L<reader_unlock|SPVM::Document::NativeAPI::Mutex/"reader_unlock"> mutex native API. | ||
| 62 | |||
| 63 | =head1 Copyright & License | ||
| 64 | |||
| 65 | Copyright (c) 2023 Yuki Kimoto | ||
| 66 | |||
| 67 | MIT License | ||
| 68 |