Skip to content

Commit

Permalink
add some more sigatomic sections. fixes JuliaLang#5399
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored and tknopp committed Jan 15, 2014
1 parent 0f865d9 commit 037ea58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion base/io.jl
Expand Up @@ -266,7 +266,12 @@ show(io::IO, s::IOStream) = print(io, "IOStream(", s.name, ")")
fd(s::IOStream) = int(ccall(:jl_ios_fd, Clong, (Ptr{Void},), s.ios))
close(s::IOStream) = ccall(:ios_close, Void, (Ptr{Void},), s.ios)
isopen(s::IOStream) = bool(ccall(:ios_isopen, Cint, (Ptr{Void},), s.ios))
flush(s::IOStream) = ccall(:ios_flush, Void, (Ptr{Void},), s.ios)
function flush(s::IOStream)
sigatomic_begin()
ccall(:ios_flush, Void, (Ptr{Void},), s.ios)
sigatomic_end()
s
end
iswritable(s::IOStream) = bool(ccall(:ios_get_writable, Cint, (Ptr{Void},), s.ios))
isreadable(s::IOStream) = bool(ccall(:ios_get_readable, Cint, (Ptr{Void},), s.ios))
modestr(s::IO) = modestr(isreadable(s), iswritable(s))
Expand Down
6 changes: 6 additions & 0 deletions src/jl_uv.c
Expand Up @@ -398,26 +398,32 @@ DLLEXPORT int jl_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle,
DLLEXPORT int jl_fs_unlink(char *path)
{
uv_fs_t req;
JL_SIGATOMIC_BEGIN();
int ret = uv_fs_unlink(jl_io_loop, &req, path, NULL);
uv_fs_req_cleanup(&req);
JL_SIGATOMIC_END();
return ret;
}

DLLEXPORT int jl_fs_rename(char *src_path, char *dst_path)
{
uv_fs_t req;
JL_SIGATOMIC_BEGIN();
int ret = uv_fs_rename(jl_io_loop, &req, src_path, dst_path, NULL);
uv_fs_req_cleanup(&req);
JL_SIGATOMIC_END();
return ret;
}

DLLEXPORT int jl_fs_sendfile(int src_fd, int dst_fd,
int64_t in_offset, size_t len)
{
uv_fs_t req;
JL_SIGATOMIC_BEGIN();
int ret = uv_fs_sendfile(jl_io_loop, &req, dst_fd, src_fd,
in_offset, len, NULL);
uv_fs_req_cleanup(&req);
JL_SIGATOMIC_END();
return ret;
}

Expand Down

0 comments on commit 037ea58

Please sign in to comment.