File: synchronized_map_backend.rb

package info (click to toggle)
ruby-concurrent 1.1.6%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 30,284 kB
  • sloc: ruby: 30,875; java: 6,117; javascript: 1,114; ansic: 288; makefile: 10; sh: 6
file content (82 lines) | stat: -rw-r--r-- 1,544 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
require 'concurrent/collection/map/non_concurrent_map_backend'

module Concurrent

  # @!visibility private
  module Collection

    # @!visibility private
    class SynchronizedMapBackend < NonConcurrentMapBackend

      require 'mutex_m'
      include Mutex_m
      # WARNING: Mutex_m is a non-reentrant lock, so the synchronized methods are
      # not allowed to call each other.

      def [](key)
        synchronize { super }
      end

      def []=(key, value)
        synchronize { super }
      end

      def compute_if_absent(key)
        synchronize { super }
      end

      def compute_if_present(key)
        synchronize { super }
      end

      def compute(key)
        synchronize { super }
      end

      def merge_pair(key, value)
        synchronize { super }
      end

      def replace_pair(key, old_value, new_value)
        synchronize { super }
      end

      def replace_if_exists(key, new_value)
        synchronize { super }
      end

      def get_and_set(key, value)
        synchronize { super }
      end

      def key?(key)
        synchronize { super }
      end

      def delete(key)
        synchronize { super }
      end

      def delete_pair(key, value)
        synchronize { super }
      end

      def clear
        synchronize { super }
      end

      def size
        synchronize { super }
      end

      def get_or_default(key, default_value)
        synchronize { super }
      end

      private
      def dupped_backend
        synchronize { super }
      end
    end
  end
end