From c3111552344022dcfe518375ca836f9fa42905db Mon Sep 17 00:00:00 2001 From: Mark Shinwell Date: Mon, 1 Feb 2021 14:23:22 +0000 Subject: [PATCH] flambda-backend: To upstream: remove threadUnix --- ocamldoc/Makefile.docfiles | 2 +- otherlibs/systhreads/.depend | 7 --- otherlibs/systhreads/Makefile | 12 +--- otherlibs/systhreads/threadUnix.ml | 65 ------------------- otherlibs/systhreads/threadUnix.mli | 98 ----------------------------- 5 files changed, 4 insertions(+), 180 deletions(-) delete mode 100644 otherlibs/systhreads/threadUnix.ml delete mode 100644 otherlibs/systhreads/threadUnix.mli diff --git a/ocamldoc/Makefile.docfiles b/ocamldoc/Makefile.docfiles index ec889635cb34..308d2b3025a6 100644 --- a/ocamldoc/Makefile.docfiles +++ b/ocamldoc/Makefile.docfiles @@ -23,7 +23,7 @@ STR_MLIS = $(addprefix $(SRC)/otherlibs/str/, str.mli) UNIX_MLIS = $(addprefix $(SRC)/otherlibs/unix/, unix.mli unixLabels.mli) DYNLINK_MLIS = $(addprefix $(SRC)/otherlibs/dynlink/, dynlink.mli) THREAD_MLIS = $(addprefix $(SRC)/otherlibs/systhreads/, \ - thread.mli condition.mli mutex.mli event.mli semaphore.mli threadUnix.mli) + thread.mli condition.mli mutex.mli event.mli semaphore.mli) DRIVER_MLIS = $(SRC)/driver/pparse.mli diff --git a/otherlibs/systhreads/.depend b/otherlibs/systhreads/.depend index 3bd0a0078f52..661d3575dec0 100644 --- a/otherlibs/systhreads/.depend +++ b/otherlibs/systhreads/.depend @@ -34,10 +34,3 @@ thread.cmo : \ thread.cmx : \ thread.cmi thread.cmi : -threadUnix.cmo : \ - thread.cmi \ - threadUnix.cmi -threadUnix.cmx : \ - thread.cmx \ - threadUnix.cmi -threadUnix.cmi : diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile index be42d0b8135b..7ebce426eb49 100644 --- a/otherlibs/systhreads/Makefile +++ b/otherlibs/systhreads/Makefile @@ -52,14 +52,12 @@ LIBNAME=threads BYTECODE_C_OBJS=st_stubs.b.$(O) NATIVECODE_C_OBJS=st_stubs.n.$(O) -THREADS_SOURCES = thread.ml mutex.ml condition.ml event.ml threadUnix.ml \ - semaphore.ml +THREADS_SOURCES = thread.ml mutex.ml condition.ml event.ml semaphore.ml THREADS_BCOBJS = $(THREADS_SOURCES:.ml=.cmo) THREADS_NCOBJS = $(THREADS_SOURCES:.ml=.cmx) -MLIFILES=thread.mli mutex.mli condition.mli event.mli threadUnix.mli \ - semaphore.mli +MLIFILES=thread.mli mutex.mli condition.mli event.mli semaphore.mli CMIFILES=$(MLIFILES:.mli=.cmi) @@ -75,12 +73,8 @@ lib$(LIBNAME)nat.$(A): $(NATIVECODE_C_OBJS) $(LIBNAME).cma: $(THREADS_BCOBJS) ifeq "$(UNIX_OR_WIN32)" "unix" - $(MKLIB) -o $(LIBNAME) -ocamlc '$(CAMLC)' -cclib -lunix -linkall \ + $(MKLIB) -o $(LIBNAME) -ocamlc '$(CAMLC)' -linkall \ $(PTHREAD_CAML_LINK) $^ -# TODO: Figure out why -cclib -lunix is used here. -# It may be because of the threadsUnix module which is deprecated. -# It may hence be good to figure out whether this module shouldn't be -# removed, and then -cclib -lunix arguments. else # Windows $(MKLIB) -o $(LIBNAME) -ocamlc "$(CAMLC)" -linkall \ $(PTHREAD_CAML_LINK) $^ diff --git a/otherlibs/systhreads/threadUnix.ml b/otherlibs/systhreads/threadUnix.ml deleted file mode 100644 index acaafb019fc3..000000000000 --- a/otherlibs/systhreads/threadUnix.ml +++ /dev/null @@ -1,65 +0,0 @@ -(**************************************************************************) -(* *) -(* OCaml *) -(* *) -(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) -(* *) -(* Copyright 1996 Institut National de Recherche en Informatique et *) -(* en Automatique. *) -(* *) -(* All rights reserved. This file is distributed under the terms of *) -(* the GNU Lesser General Public License version 2.1, with the *) -(* special exception on linking described in the file LICENSE. *) -(* *) -(**************************************************************************) - -(* Module [ThreadUnix]: thread-compatible system calls *) - -open Unix - -(*** Process handling *) - -external execv : string -> string array -> unit = "unix_execv" -external execve : string -> string array -> string array -> unit - = "unix_execve" -external execvp : string -> string array -> unit = "unix_execvp" -let wait = Unix.wait -let waitpid = Unix.waitpid -let system = Unix.system -let read = Unix.read -let write = Unix.write -let write_substring = Unix.write_substring -let select = Unix.select - -let timed_read fd buff ofs len timeout = - if Thread.wait_timed_read fd timeout - then Unix.read fd buff ofs len - else raise (Unix_error(ETIMEDOUT, "timed_read", "")) - -let timed_write fd buff ofs len timeout = - if Thread.wait_timed_write fd timeout - then Unix.write fd buff ofs len - else raise (Unix_error(ETIMEDOUT, "timed_write", "")) - -let timed_write_substring fd buff ofs len timeout = - timed_write fd (Bytes.unsafe_of_string buff) ofs len timeout - -let pipe = Unix.pipe - -let open_process_in = Unix.open_process_in -let open_process_out = Unix.open_process_out -let open_process = Unix.open_process - -external sleep : int -> unit = "unix_sleep" - -let socket = Unix.socket -let accept = Unix.accept -external connect : file_descr -> sockaddr -> unit = "unix_connect" -let recv = Unix.recv -let recvfrom = Unix.recvfrom -let send = Unix.send -let send_substring = Unix.send_substring -let sendto = Unix.sendto -let sendto_substring = Unix.sendto_substring - -let open_connection = Unix.open_connection diff --git a/otherlibs/systhreads/threadUnix.mli b/otherlibs/systhreads/threadUnix.mli deleted file mode 100644 index 5d904e72c580..000000000000 --- a/otherlibs/systhreads/threadUnix.mli +++ /dev/null @@ -1,98 +0,0 @@ -(**************************************************************************) -(* *) -(* OCaml *) -(* *) -(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) -(* *) -(* Copyright 1996 Institut National de Recherche en Informatique et *) -(* en Automatique. *) -(* *) -(* All rights reserved. This file is distributed under the terms of *) -(* the GNU Lesser General Public License version 2.1, with the *) -(* special exception on linking described in the file LICENSE. *) -(* *) -(**************************************************************************) - -(** Thread-compatible system calls. - - @deprecated The functionality of this module has been merged back into - the {!Unix} module. Threaded programs can now call the functions - from module {!Unix} directly, and still get the correct behavior - (block the calling thread, if required, but do not block all threads - in the process). *) - -[@@@ocaml.deprecated "Use the Unix module instead of ThreadUnix"] - -(** {1 Process handling} *) - -val execv : string -> string array -> unit -val execve : string -> string array -> string array -> unit -val execvp : string -> string array -> unit -val wait : unit -> int * Unix.process_status -val waitpid : Unix.wait_flag list -> int -> int * Unix.process_status -val system : string -> Unix.process_status - -(** {1 Basic input/output} *) - -val read : Unix.file_descr -> bytes -> int -> int -> int -val write : Unix.file_descr -> bytes -> int -> int -> int -val write_substring : Unix.file_descr -> string -> int -> int -> int - -(** {1 Input/output with timeout} *) - -val timed_read : - Unix.file_descr -> - bytes -> int -> int -> float -> int -(** See {!ThreadUnix.timed_write}. *) - -val timed_write : - Unix.file_descr -> - bytes -> int -> int -> float -> int -(** Behave as {!ThreadUnix.read} and {!ThreadUnix.write}, except that - [Unix_error(ETIMEDOUT,_,_)] is raised if no data is - available for reading or ready for writing after [d] seconds. - The delay [d] is given in the fifth argument, in seconds. *) - -val timed_write_substring : - Unix.file_descr -> string -> int -> int -> float -> int -(** See {!ThreadUnix.timed_write}. *) - -(** {1 Polling} *) - -val select : - Unix.file_descr list -> Unix.file_descr list -> - Unix.file_descr list -> float -> - Unix.file_descr list * Unix.file_descr list * Unix.file_descr list - -(** {1 Pipes and redirections} *) - -val pipe : ?cloexec:bool -> unit -> Unix.file_descr * Unix.file_descr -val open_process_in: string -> in_channel -val open_process_out: string -> out_channel -val open_process: string -> in_channel * out_channel - -(** {1 Time} *) - -val sleep : int -> unit - -(** {1 Sockets} *) - -val socket : - ?cloexec:bool -> Unix.socket_domain -> Unix.socket_type -> int -> - Unix.file_descr -val accept : - ?cloexec:bool -> Unix.file_descr -> Unix.file_descr * Unix.sockaddr -val connect : Unix.file_descr -> Unix.sockaddr -> unit -val recv : Unix.file_descr -> bytes -> - int -> int -> Unix.msg_flag list -> int -val recvfrom : Unix.file_descr -> bytes -> int -> int -> - Unix.msg_flag list -> int * Unix.sockaddr -val send : Unix.file_descr -> bytes -> int -> int -> - Unix.msg_flag list -> int -val send_substring : Unix.file_descr -> string -> int -> int -> - Unix.msg_flag list -> int -val sendto : Unix.file_descr -> bytes -> int -> int -> - Unix.msg_flag list -> Unix.sockaddr -> int -val sendto_substring : Unix.file_descr -> string -> int -> int -> - Unix.msg_flag list -> Unix.sockaddr -> int -val open_connection : Unix.sockaddr -> in_channel * out_channel