mt_helpers
mt_helpers
Helper shard for MT in Crystal
Installation
-
Add the dependency to your
shard.yml
:dependencies: mt_helpers: github: NeuraLegion/mt_helpers
-
Run
shards install
Usage
This shard give two new structures, Synchronized
and Synchronizable
they can be used differently.
Synchronized:
require "mt_helpers"
synchronized_array = Synchronized(Array(String)).new(
[
"a",
"b",
"c"
]
)
synchronized_array.each
synchronized_array << "d"
synchronized_array.safe_inner # returns a clone of the inner object
The above will create a MultiThread safe Array.
Synchronizable:
require "mt_helpers"
class Foo
include Synchronizable
def safe_loop
synchronize do
@a << "a"
end
end
end
Contributing
- Fork it (https://github.com/NeuraLegion/mt_helpers/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Bar Hofesh - creator and maintainer
Repository
mt_helpers
Owner
Statistic
- 8
- 1
- 0
- 1
- 0
- over 2 years ago
- May 27, 2020
License
MIT License
Links
Synced at
Sat, 21 Dec 2024 09:27:28 GMT
Languages