Skip to content

Commit

Permalink
rename Void => Cvoid, Nothing (depending on usage)
Browse files Browse the repository at this point in the history
git ls-files base doc examples src stdlib test | xargs perl -i -ple '/\b(ccall|cglobal|cfunction)\b/ && s/\bVoid\b/Cvoid/g'
git ls-files base doc examples src stdlib test | xargs perl -i -ple 's/\bPtr\{Void\}/Ptr{Cvoid}/g'
git ls-files base doc examples src stdlib test | xargs perl -i -ple 's/\Ref\{Void\}/Ref{Cvoid}/g'
perl -i -ple 's/\bVoid\b/Cvoid/g' base/atomics.jl base/libgit2/status.jl base/random/dSFMT.jl doc/src/manual/calling-c-and-fortran-code.md test/llvmcall.jl test/threads.jl
git ls-files base doc examples src stdlib test | xargs perl -i -ple 's/\bVoid\b/Nothing/g'
  • Loading branch information
StefanKarpinski committed Dec 20, 2017
1 parent 2f0b777 commit 449244e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
40 changes: 20 additions & 20 deletions src/cluster.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,41 @@ abstract type ClusterManager end

mutable struct WorkerConfig
# Common fields relevant to all cluster managers
io::Union{IO, Void}
host::Union{AbstractString, Void}
port::Union{Integer, Void}
io::Union{IO, Nothing}
host::Union{AbstractString, Nothing}
port::Union{Integer, Nothing}

# Used when launching additional workers at a host
count::Union{Int, Symbol, Void}
exename::Union{AbstractString, Cmd, Void}
exeflags::Union{Cmd, Void}
count::Union{Int, Symbol, Nothing}
exename::Union{AbstractString, Cmd, Nothing}
exeflags::Union{Cmd, Nothing}

# External cluster managers can use this to store information at a per-worker level
# Can be a dict if multiple fields need to be stored.
userdata::Any

# SSHManager / SSH tunnel connections to workers
tunnel::Union{Bool, Void}
bind_addr::Union{AbstractString, Void}
sshflags::Union{Cmd, Void}
max_parallel::Union{Integer, Void}
tunnel::Union{Bool, Nothing}
bind_addr::Union{AbstractString, Nothing}
sshflags::Union{Cmd, Nothing}
max_parallel::Union{Integer, Nothing}

# Used by Local/SSH managers
connect_at::Any

process::Union{Process, Void}
ospid::Union{Integer, Void}
process::Union{Process, Nothing}
ospid::Union{Integer, Nothing}

# Private dictionary used to store temporary information by Local/SSH managers.
environ::Union{Dict, Void}
environ::Union{Dict, Nothing}

# Connections to be setup depending on the network topology requested
ident::Any # Worker as identified by the Cluster Manager.
# List of other worker idents this worker must connect with. Used with topology T_CUSTOM.
connect_idents::Union{Array, Void}
connect_idents::Union{Array, Nothing}

# Run multithreaded blas on worker
enable_threaded_blas::Union{Bool, Void}
enable_threaded_blas::Union{Bool, Nothing}

function WorkerConfig()
wc = new()
Expand Down Expand Up @@ -67,10 +67,10 @@ mutable struct Worker
# serializer as part of the Worker object
manager::ClusterManager
config::WorkerConfig
version::Union{VersionNumber, Void} # Julia version of the remote process
version::Union{VersionNumber, Nothing} # Julia version of the remote process

function Worker(id::Int, r_stream::IO, w_stream::IO, manager::ClusterManager;
version::Union{VersionNumber, Void}=nothing,
version::Union{VersionNumber, Nothing}=nothing,
config::WorkerConfig=WorkerConfig())
w = Worker(id)
w.r_stream = r_stream
Expand Down Expand Up @@ -673,7 +673,7 @@ mutable struct ProcessGroup
workers::Array{Any,1}
refs::Dict # global references
topology::Symbol
lazy::Union{Bool, Void}
lazy::Union{Bool, Nothing}

ProcessGroup(w::Array{Any,1}) = new("pg-default", w, Dict(), :all_to_all, nothing)
end
Expand Down Expand Up @@ -1036,10 +1036,10 @@ end

function disable_nagle(sock)
# disable nagle on all OSes
ccall(:uv_tcp_nodelay, Cint, (Ptr{Void}, Cint), sock.handle, 1)
ccall(:uv_tcp_nodelay, Cint, (Ptr{Cvoid}, Cint), sock.handle, 1)
@static if Sys.islinux()
# tcp_quickack is a linux only option
if ccall(:jl_tcp_quickack, Cint, (Ptr{Void}, Cint), sock.handle, 1) < 0
if ccall(:jl_tcp_quickack, Cint, (Ptr{Cvoid}, Cint), sock.handle, 1) < 0
@warn "Networking unoptimized ( Error enabling TCP_QUICKACK : $(Libc.strerror(Libc.errno())) )" maxlog=1
end
end
Expand Down
4 changes: 2 additions & 2 deletions src/managers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ function socket_reuse_port()
bind_early = Sys.islinux()

bind_early && bind_client_port(s)
rc = ccall(:jl_tcp_reuseport, Int32, (Ptr{Void},), s.handle)
rc = ccall(:jl_tcp_reuseport, Int32, (Ptr{Cvoid},), s.handle)
if rc < 0
# This is an issue only on systems with lots of client connections, hence delay the warning
nworkers() > 128 && @warn "Error trying to reuse client port number, falling back to regular socket" maxlog=1
Expand All @@ -485,7 +485,7 @@ function socket_reuse_port()
end

function bind_client_port(s)
err = ccall(:jl_tcp_bind, Int32, (Ptr{Void}, UInt16, UInt32, Cuint),
err = ccall(:jl_tcp_bind, Int32, (Ptr{Cvoid}, UInt16, UInt32, Cuint),
s.handle, hton(client_port[]), hton(UInt32(0)), 0)
uv_error("bind() failed", err)

Expand Down
2 changes: 1 addition & 1 deletion src/messages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct MsgHeader
end

# Special oid (0,0) uses to indicate a null ID.
# Used instead of Union{Int, Void} to decrease wire size of header.
# Used instead of Union{Int, Nothing} to decrease wire size of header.
null_id(id) = id == RRID(0, 0)

struct CallMsg{Mode} <: AbstractMsg
Expand Down
8 changes: 4 additions & 4 deletions src/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ precompile(Tuple{typeof(Base.ht_keyindex2!), Base.Dict{Any, Any}, Distributed.RR
precompile(Tuple{typeof(Base._setindex!), Base.Dict{Any, Any}, Distributed.RemoteValue, Distributed.RRID, Int64})
precompile(Tuple{typeof(Base.notify), Base.Condition, Distributed.ProcessExitedException, Bool, Bool})
precompile(Tuple{typeof(Distributed.process_messages), Base.TCPSocket, Base.TCPSocket, Bool})
precompile(Tuple{typeof(Base.pop!), Base.Dict{Int64, Union{Distributed.Worker, Distributed.LocalProcess}}, Int64, Void})
precompile(Tuple{typeof(Base.pop!), Base.Dict{Int64, Union{Distributed.Worker, Distributed.LocalProcess}}, Int64, Nothing})
precompile(Tuple{typeof(Distributed.send_connection_hdr), Distributed.Worker, Bool})
precompile(Tuple{typeof(Distributed.deregister_worker), Distributed.ProcessGroup, Int64})
precompile(Tuple{typeof(Distributed.process_hdr), Base.TCPSocket, Bool})
Expand Down Expand Up @@ -190,7 +190,7 @@ precompile(Tuple{Type{Distributed.ResultMsg}, Distributed.RemoteException})
precompile(Tuple{Type{Distributed.ResultMsg}, Symbol})
precompile(Tuple{typeof(Distributed.send_msg_now), Base.TCPSocket, Distributed.MsgHeader, Distributed.ResultMsg})
precompile(Tuple{typeof(Base.notify), Base.Condition, Distributed.ProcessExitedException, Bool, Bool})
precompile(Tuple{typeof(Base.pop!), Base.Dict{Int64, Union{Distributed.Worker, Distributed.LocalProcess}}, Int64, Void})
precompile(Tuple{typeof(Base.pop!), Base.Dict{Int64, Union{Distributed.Worker, Distributed.LocalProcess}}, Int64, Nothing})
precompile(Tuple{typeof(Distributed.deregister_worker), Distributed.ProcessGroup, Int64})
precompile(Tuple{typeof(Distributed.process_hdr), Base.TCPSocket, Bool})
precompile(Tuple{typeof(Distributed.null_id), Distributed.RRID})
Expand Down Expand Up @@ -226,7 +226,7 @@ precompile(Tuple{typeof(Base.Serializer.deserialize), Distributed.ClusterSeriali
precompile(Tuple{Type{Distributed.JoinCompleteMsg}, Int64, Int64})
precompile(Tuple{typeof(Distributed.handle_msg), Distributed.JoinCompleteMsg, Distributed.MsgHeader, Base.TCPSocket, Base.TCPSocket, Base.VersionNumber})
precompile(Tuple{typeof(Base.hash), Distributed.RemoteChannel{Base.Channel{Any}}, UInt64})
precompile(Tuple{typeof(Base.ht_keyindex), Base.Dict{WeakRef, Void}, Distributed.RemoteChannel{Base.Channel{Any}}})
precompile(Tuple{typeof(Base.ht_keyindex), Base.Dict{WeakRef, Nothing}, Distributed.RemoteChannel{Base.Channel{Any}}})
precompile(Tuple{typeof(Distributed.remotecall_fetch), typeof(Distributed.put_ref), Distributed.Worker, Distributed.RRID, Distributed.WorkerPool})
precompile(Tuple{typeof(Distributed.remotecall_fetch), typeof(Distributed.put_ref), Distributed.LocalProcess, Distributed.RRID, Distributed.WorkerPool})
precompile(Tuple{getfield(Distributed, Symbol("#kw##remotecall_fetch")), Array{Any, 1}, typeof(Distributed.remotecall_fetch), typeof(Distributed.put_ref), Distributed.Worker, Distributed.RRID, Distributed.WorkerPool})
Expand Down Expand Up @@ -276,6 +276,6 @@ precompile(Tuple{typeof(Distributed.terminate_all_workers)})
precompile(Tuple{typeof(Distributed.test_existing_ref), Distributed.Future})
precompile(Tuple{typeof(Base.finalizer), Distributed.Future, typeof(Distributed.finalize_ref)})
precompile(Tuple{typeof(Base.hash), Distributed.Future, UInt64})
precompile(Tuple{typeof(Base.ht_keyindex), Base.Dict{WeakRef, Void}, Distributed.Future})
precompile(Tuple{typeof(Base.ht_keyindex), Base.Dict{WeakRef, Nothing}, Distributed.Future})
precompile(Tuple{typeof(Base.sync_add), Distributed.Future})
precompile(Tuple{Type{Union{}}, Distributed.RRID})
6 changes: 3 additions & 3 deletions src/remotecall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Tracks whether a particular `AbstractRemoteRef`
The `client_refs` lock is also used to synchronize access to `.refs` and associated `clientset` state.
"""
const client_refs = WeakKeyDict{Any, Void}() # used as a WeakKeySet
const client_refs = WeakKeyDict{Any, Nothing}() # used as a WeakKeySet

abstract type AbstractRemoteRef end

Expand All @@ -22,9 +22,9 @@ mutable struct Future <: AbstractRemoteRef
where::Int
whence::Int
id::Int
v::Union{Some{Any}, Void}
v::Union{Some{Any}, Nothing}

Future(w::Int, rrid::RRID, v::Union{Some, Void}=nothing) =
Future(w::Int, rrid::RRID, v::Union{Some, Nothing}=nothing) =
(r = new(w,rrid.whence,rrid.id,v); return test_existing_ref(r))

Future(t::NTuple{4, Any}) = new(t[1],t[2],t[3],t[4]) # Useful for creating dummy, zeroed-out instances
Expand Down
2 changes: 1 addition & 1 deletion src/workerpool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ performs a `remote_do` on it.
"""
remote_do(f, pool::AbstractWorkerPool, args...; kwargs...) = remotecall_pool(remote_do, f, pool, args...; kwargs...)

const _default_worker_pool = Ref{Union{WorkerPool, Void}}(nothing)
const _default_worker_pool = Ref{Union{WorkerPool, Nothing}}(nothing)

"""
default_worker_pool()
Expand Down

0 comments on commit 449244e

Please sign in to comment.