Skip to content

Commit

Permalink
Protect R. against concurrent access
Browse files Browse the repository at this point in the history
  • Loading branch information
lbguilherme committed Mar 8, 2020
1 parent a37c4cb commit fa44634
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/driver/dsl.cr
Expand Up @@ -10,11 +10,11 @@ end
module RethinkDB
module DSL
module R
@@next_var_i = 1i64
@@next_var_i = Atomic(Int64).new(1i64)
alias Type = Array(Type) | Bool | Float64 | Hash(String, Type) | Int64 | Int32 | String | Nil | Time | R

def self.reset_next_var_i
@@next_var_i = 1i64
@@next_var_i.set(1i64)
end

def self.convert_type(x : R, max_depth)
Expand Down Expand Up @@ -89,9 +89,7 @@ module RethinkDB
end

def self.make_var_i
i = @@next_var_i
@@next_var_i += 1
i
@@next_var_i.add(1)
end

def self.expr(*args)
Expand Down

0 comments on commit fa44634

Please sign in to comment.