Skip to content
Commits on Source (18)
_build
src/unix/lwt_config
*.flag
# OPAM 2.0 local switches.
_opam
# NPM.
node_modules/
package-lock.json
# package-lock.json should probably be committed once we know what we're doing.
# Coverage analysis.
bisect*.out
_coverage/
# For local work, tests, etc.
scratch/
# Autogenerated by jbuider
.merlin
*.install
# BuckleScript output.
lib/
# Wikidoc output.
/docs/api/
# Junk from packaging tests.
*.cm*
*.o
a.out
language: c
matrix:
include:
- os: osx
env: COMPILER=4.08.1 LIBEV=no
- os: linux
env: COMPILER=4.08.1 COVERAGE=yes
- os: linux
env: COMPILER=4.02.3 LIBEV=no
- os: linux
env: COMPILER=4.03.0
- os: linux
env: COMPILER=4.04.2
- os: linux
env: COMPILER=4.05.0
- os: linux
env: COMPILER=4.06.1
- os: linux
env: COMPILER=4.07.1
- os: linux
env: COMPILER=ocaml-variants.4.07.1+flambda
- os: linux
env: COMPILER=ocaml-variants.4.09.0+beta1 REPOSITORIES=--repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
allow_failures:
- env: COMPILER=ocaml-variants.4.09.0+beta1 REPOSITORIES=--repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
fast_finish: true
env:
global:
- LWT_FORCE_LIBEV_BY_DEFAULT=yes
- LWT_STRESS_TEST=true
script: bash -e src/util/travis.sh
cache:
directories:
- $HOME/.opam
- ./_opam
notifications:
email:
recipients:
- antonbachin@yahoo.com
on_success: always
on_failure: always
===== 4.3.0 (2019-08-20) =====
====== Planned to break in 5.0.0 ======
For general discussion of breakage in Lwt 5.0.0, see #584. See #293 about how
Lwt announces and does breaking changes.*
* The signature of Lwt.async will change from (unit -> 'a Lwt.t) -> unit to
(unit -> unit Lwt.t) -> unit (#603, prompted @cfcs).
* Lwt_unix.send_msg and Lwt_unix.recv_msg will be changed to take
Lwt_unix.IO_vectors.t instead of Lwt_unix.io_vectors (#702, prompted
Marcello Seri).
* Nesting calls to Lwt_main.run will be forbidden, and will raise an
Failure. Most programs don't do this (#609, prompted François-René Rideau).
* configure.ml will be removed in favor of an improved discover.ml This
affects only users who are configuring Lwt as part of a manual installation
(i.e., not users of opam or esy). See discover.ml for usage (#700).
* Lwt_unix.async_method will have no effect. In practice, it already does
nothing, and has almost no users (#572).
====== Additions ======
* Lwt_process: allow setting working directory for new processes (#694, Thomas
Leonard).
* PPX: use OCaml 4.08 ASTs to support latest features (#697).
* Lwt_io.NumberIO: use compiler intrinsics for better performance (#178,
requested Mauricio Fernandez).
====== Bugs fixed ======
* Race condition in Lwt_react.S.limit (4e592eb).
* Use fallback rule during configuration (#693, Hongchang Wu).
* Fix typos (#688, #692, @Fourchaux).
===== 4.2.1 (2019-04-02) =====
====== Bug fixed ======
* Detect libev correctly when building under esy (#679, Antonio Nuno
Monteiro).
===== 4.2.0 (2019-03-25) =====
====== Additions ======
* Lwt.both (#668, Brendan Long, Jeremy Yallop).
* ppx_let support with open Lwt.Infix (#667, Brendan Long).
* Lwt_stream.of_seq (#646, Hezekiah Carty).
* Lwt_io.is_closed (#635, Andreas Garnaes).
* Lwt_unix.IO_vectors.byte_count (#645, Raphaël Proust).
* Support for higher baud rates in Lwt_unix.tcgetattr and Lwt_unix.tcsetattr
(#678, Frédéric Fortier).
* Replacement functions in Lwt_main for deprecated functions based on
Lwt_sequence (#660).
====== Bugs fixed ======
* 4.08 compatibility (#658).
* Stack overflow in Lwt_stream.iter_p (#432, Varun Kohli).
* Incorrect bounds check in Lwt_bytes.mincore (#627, Cédric Le Moigne).
* Lwt_bytes.mincore will not be available in future releases of OpenBSD (#663,
Kenneth Westerback).
* Missing header in the Android build (#652, Justus Matthiesen).
* Build broken on MSVC (98303de, 85535f7, Dmitry Bely).
* Build broken on OpenBSD (#672, Christopher Zimmermann).
* Lwt_io.of_bytes produces a channel with inaccurate positions (#636, Nathan
Rebours).
* Lwt_io._.read_int behaves incorrectly on 32-bit systems (#671, reported
Dmitry Bely).
* Inaccurate locations for errors related to ;%lwt (#602, @kandu).
* (_ : t) not recognized as a catch-all pattern by the PPX (#640, Florian
Angeletti).
* Race condition in Lwt_react.E.limit (#606, Avni Fatehpuria).
* Premature deallocation in Lwt_react.E.with_finaliser and
Lwt_react.S.with_finaliser (#626, El-Hassan Wanas).
====== Miscellaneous ======
* New tests for Lwt_bytes, portions of Lwt_unix (#619, #621, #628, #630, #673,
Cédric Le Moigne, Anurag Soni).
* Test suite improvements (#656, Dave Parfitt).
* Clarifications for documentation of Lwt.try_bind, Lwt.pick (#648, #650,
Bikal Lem).
* Fixed documentation of Lwt_io.read_line (#657, Yoni Levy).
* Fixed some typos (#611, #613, Rich Neswold).
===== 4.1.0 (2018-06-26) =====
====== Additions ======
* Change license to MIT (#560).
* Lwt_fmt, an Lwt-aware version of Format (#548, Gabriel Radanne).
* Lwt_io.establish_server_with_client_socket (#586).
====== Bugs fixed ======
* Lwt_stream.iter_n: rename ?max_threads argument to ?max_concurrency (#581,
Hezekiah Carty).
* PPX: reject match expressions that have only exception cases (#597, Raphaël
Proust).
====== Miscellaneous ======
* Improvements to Lwt_pool docs (#575, Bobby Priambodo).
* Restore all PPX tests (#590, Jess Smith).
===== 4.0.1 (2018-04-13) =====
====== Bugs fixed ======
* Race condition in worker thread management in Lwt_unix (#569, diagnosed Gabe
Levi).
* Hang in Lwt_unix.read on Windows (#574, #569, 86a6baf, diagnosed Gabe Levi).
* Docs: note that Lwt_io.open_file for writing truncates the file by default
(#570, reported Tóth Róbert).
===== 4.0.0 (2018-03-30) =====
====== Breaking ======
These changes were announced in Lwt 3.1.0 and Lwt 3.2.0. See #453 about smooth
upgrade paths.
* Delete package lwt.ppx. The PPX syntax is in package lwt_ppx since Lwt 3.2.0
(#338).
* Remove >> syntax from the PPX (#495).
* Delete modules Lwt_log, Lwt_daemon, Lwt_log_core, and package lwt.log. These
are in package lwt_log since Lwt 3.2.0, but it is recommended to use
Logs_lwt from the logs library instead (#484, initiated Hannes Mehnert).
* Delete package lwt.preemptive. It is an alias for lwt.unix since Lwt 3.2.0
(#487).
* Delete package lwt.syntax. The Camlp4 syntax is in package lwt_camlp4 since
Lwt 3.2.0 (#370).
* Delete module Lwt_chan, a predecessor of Lwt_io (#441).
* Delete package lwt.simple-top, a predecessor of utop (#371).
* Make resolvers (Lwt.u) contravariant (#458).
====== Planned to break in 5.0.0 ======
* Lwt.pick will raise Invalid_argument on the empty list, instead of returning
a forever-pending promise. Also applies to Lwt.choose, Lwt.npick,
Lwt.nchoose, and Lwt.nchoose_split (#562, Tim Reinke, prompted Hezekiah
Carty).
* Remove translation of [%lwt ...] to Lwt.catch from the PPX (#527).
* Remove -no-debug option from the PPX (#528).
* Remove Lwt_log support from the PPX (#520).
====== Bugs fixed ======
* Lwt_io.file_length now fails with EISDIR when used on a directory (#563,
requested Cedric Cellier).
* Lwt_react.E.limit and Lwt_react.S.limit now working more correctly (#566,
@Freyr666).
====== Miscellaneous ======
* Documentation improvements (#561, Jason Evans).
===== 3.3.0 (2018-03-07) =====
====== Bugs fixed ======
* Restore backtrace support (#554, #556, Gabe Levi).
* Serious logic error that could cause Lwt to hang or crash (#549, reported
@koen-struyve).
* All Lwt_list functions are now tail-recursive (#538, Joseph Thomas).
====== Additions ======
* Support ;%lwt syntax in the PPX (#307, Hezekiah Carty).
* Lwt_stream.iter_n (#312, Hezekiah Carty).
====== Miscellaneous ======
* Testing improvements (#536, #541, @cedlemo).
* Documentation improvements (#544, #546, #547, #553, #559, Daniil Baturin,
Jason Evans, Jess Smith, Milo Turner).
===== 3.2.1 (2018-01-11) =====
Lwt 3.2.1 is released because it still packages lwt.ppx, a deprecated copy of
package lwt_ppx, and the two packages should be kept in sync.
====== Deprecations ======
* All PPX options are deprecated and should not be used (#534).
* The [%lwt ...] PPX syntax should be replaced by Lwt.catch (#534).
====== Fixes ======
* Clean up PPX -help usage message output (#525, Zan Doye).
====== Miscellaneous ======
* More thorough testing (#512, #535, Joseph Thomas).
* Clarification of the C binding (#521, @cedlemo).
===== 3.2.0 (2017-12-19) =====
====== Additions ======
* Lwt_mvar.take_available, Lwt_mvar.is_empty (#459, Hezekiah Carty).
* Lwt_io.open_temp_file, Lwt_io.with_temp_file (#467, Joe Thomas).
* New reference documentation for module Lwt (#469).
* Lwt_pool.clear and ?dispose argument for Lwt_pool.create (#483,
Hezekiah Carty).
* Lwt_pool.wait_queue_length (#493, Jerome Vouillon).
====== Bugs fixed ======
* Lwt.npick never worked (#447, Zack Coker).
* Lwt_pool.use now always calls ?validate on elements (#461, Joe Thomas).
* Better locations generated by the PPX (#470, Fabian Hemmer).
* Keep worker thread count accurate in Lwt_unix when pthread_create fails
(#493, @koen-struyve).
* Leaked exceptions in Lwt_list (#499).
* Memory leak in Lwt_unix.getnameinfo (#503, Hannes Mehnert).
====== Planned to break in 4.0.0 ======
See #453 for details and instructions about planned breakage in Lwt 4.0.0.
* The semantics of Lwt will be adjusted for better exception and stack safety
(#500).
* The PPX will be factored out into its own opam package, lwt_ppx. This
package is installable from opam now, as of Lwt 3.2.0 (#338).
* Similarly, the deprecated Camlp4 syntax will be factored out into
lwt_camlp4, which is installable from opam now (#370).
* Modules Lwt_log, Lwt_log_core, Lwt_log_rules, and Lwt_daemon are being
deprecated and factored out into opam package lwt_log, also installable from
opam now. Use the logs library for logging, in particular module Logs_lwt.
Direct daemonization is deprecated on most platforms (#484, Hannes Mehnert).
* The >> construct from the PPX will be deleted (#471, Raphaël Proust).
* Package lwt.preemptive is being merged into lwt.unix. In 3.2.0,
lwt.preemptive becomes an alias for lwt.unix, and the package name
lwt.preemptive will be deleted in 4.0.0 (#487).
====== Deprecations ======
* Lwt.waiter_of_wakener should not be used, as it can lead to soundness bugs
in future (but not current) Lwt (#458).
* Lwt_sequence was deprecated in Lwt 2.6.0, but it now has a warning attached,
as do Lwt.add_task_r and Lwt.add_task_l, which use it (#361).
* Use of the following functions is discouraged, but they have not yet
received deprecation warnings: Lwt.with_value, Lwt.cancel, Lwt.state,
Lwt.ignore_result (#359, #469).
====== Miscellaneous ======
* Replace references to Camlp4 in the manual with the PPX (#457, Bobby
Priambodo).
* More tests for Lwt_pool (#464, Joe Thomas).
* Expect tests for the PPX (#474, Fabian Hemmer).
===== 3.1.0 (2017-07-19) =====
====== Additions ======
* Port to Jbuilder (#374, Andrew Ray).
* Lwt_io.establish_server_with_client_address (#346, Rudi Grinberg).
* Lwt_unix.getcwd (#403, Raphaël Proust).
====== Planned to break in 4.0.0 ======
* Delete lwt.simple-top (#371).
* Delete Lwt_chan (#441).
====== Fixes ======
* Make Lwt_log functions tail-recursive (#348, Jan Doms).
* Make more of Lwt_list tail-recursive (#347, Jan Doms).
* Improve string messages in exceptions (#368, #382, Jan Doms, Raphaël
Proust).
* Don't call Unix.set_nonblock or Unix.clear_nonblock unnecessarily on
some fds (#356, David Sheets).
* Lwt_unix.sleep and Lwt_unix.timeout returning too early when using
libev (#433, Stijn Devriendt).
* Lwt_sequence.fold_r iterating the wrong way in some cases (#405,
Stijn Devriendt).
* Build conflicts in some cases due to duplicate cst_to_constr
function (#362, Jérémie Dimino).
* Don't use deprecated readdir_r system call (#430, Raphaël Proust).
====== Miscellaneous ======
* The Lwt core, lwt.ml, has been thoroughly refactored and commented
(#354, reviewed Gabriel Radanne, Edwin Török, Raphaël Proust, Jan
Doms, Fabian Hemmer, Sebastien Mondet, Simon Cruanes, Anil
Madhavapeddy, Pierre Chambart, and many others).
* Lots of tests for most of the Lwt core (#339, #389, #392, #440,
#448, #450, Joseph Thomas, Ryan Slade).
* Documentation fixes (including by Joseph Thomas, Raphaël Proust,
Richard Degenne, Stavros Polymenis).
* Contributing documentation (#379).
* Massively adjust whitespace for legibility (#400, #409, #416,
Richard Degenne).
* Improvements to CI (Etienne Millon, Raphael Rafatpanah, Zack Coker,
Yotam Barnoy).
* The additional packages lwt_ssl, lwt_react, lwt_glib get new minor
releases, the change being new Jbuilder build systems (#374, Andrew
Ray).
===== 3.0.0 (2017-04-10) =====
====== Breaking ======
* These changes were originally announced in release 2.7.0 (#308).
* Lwt_engine.libev now has an optional argument for selecting the libev back
end (#269, #294, Jeremy Yallop).
* Lwt_io.establish_server has been changed to make it more difficult to leak
file descriptors (#258, #260).
* Lwt_io.shutdown_server now evaluates to a promise, which completes when the
listening socket's close(2) operation completes (#259).
* Lwt_unix.bind now evaluates to a promise, because the bind(2) system call
can block for Unix domain sockets (#296, requested David Sheets).
* ocamlfind packages lwt.react, lwt.ssl, lwt.glib are replaced by lwt_react,
lwt_ssl, lwt_glib. These have been separate OPAM packages, under those
names, since 2.7.0 (#301).
===== 2.7.1 (2017-04-08) =====
====== Fixes ======
......@@ -131,7 +450,7 @@
* Improve wildcard detection in the ppx (#198)
* Fix Lwt_stream: bounded_push#close wake the reader (#201)
* Fix infinite loop with Lwt_stream.choose (#214)
* Fix lazyness failure with Lwt_io.common#close (#207)
* Fix laziness failure with Lwt_io.common#close (#207)
===== 2.5.1 (2015-12-07) =====
......@@ -347,7 +666,7 @@
* {{{Lwt_unix}}} now use libev instead of select
* Add thread local storage support to {{{Lwt}}}
* Add backtrace support to {{{Lwt}}}. Now {{{Lwt}}} exceptions can
be recored by using the syntax extension with the {{{-lwt-debug}}}
be recorded by using the syntax extension with the {{{-lwt-debug}}}
command line switch.
* Allow blocking system calls to be executed in parallels
* Change the type of many functions of {{{Lwt_unix}}}, which now
......@@ -397,7 +716,7 @@
* Allow to use {{{select}}} on arbitrary high file descriptors
* More commands and features in {{{Lwt_read_line}}}:
** Handle "undo" command
** New controlable read-lines instances
** New controllable read-lines instances
** More edition commands
** Completion as you type
** Backward search
......
Copyright (c) 1999-2019, the Authors of Lwt (docs/AUTHORS)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Makefile
# --------
# Copyright : (c) 2012, Jérémie Dimino <jeremie@dimino.org>
# Licence : BSD3
#
# Generic Makefile for oasis project
# Suppress duplicate topdirs.cmi warnings.
OCAMLFIND_IGNORE_DUPS_IN = $(shell ocamlfind query compiler-libs)
export OCAMLFIND_IGNORE_DUPS_IN
# Set to setup.exe for the release
SETUP := setup.exe
# Default rule
.PHONY: default
default: build
# Setup for the development version
setup-dev.exe: _oasis setup.ml
grep -v '^#' setup.ml > setup_dev.ml
ocamlfind ocamlopt -o $@ -linkpkg -package ocamlbuild,oasis.dynrun setup_dev.ml || \
ocamlfind ocamlc -o $@ -linkpkg -package ocamlbuild,oasis.dynrun setup_dev.ml || true
rm -f setup_dev.*
# Setup for the release
setup.exe: setup.ml
ocamlopt.opt -o $@ $< || ocamlopt -o $@ $< || ocamlc -o $@ $<
rm -f setup.cmx setup.cmi setup.o setup.obj setup.cmo
setup: $(SETUP)
build: $(SETUP) setup.data
./$(SETUP) -build $(BUILDFLAGS)
doc: $(SETUP) setup.data build
./$(SETUP) -doc $(DOCFLAGS)
doc-api: $(SETUP) setup.data build
./$(SETUP) -build lwt-api.docdir/index.html
test: $(SETUP) setup.data build clean-coverage
./$(SETUP) -test $(TESTFLAGS)
all: $(SETUP)
./$(SETUP) -all $(ALLFLAGS)
install: $(SETUP) setup.data
./$(SETUP) -install $(INSTALLFLAGS)
uninstall: $(SETUP) setup.data
./$(SETUP) -uninstall $(UNINSTALLFLAGS)
reinstall: $(SETUP) setup.data
./$(SETUP) -reinstall $(REINSTALLFLAGS)
clean: $(SETUP) clean-coverage
./$(SETUP) -clean $(CLEANFLAGS)
distclean: $(SETUP)
./$(SETUP) -distclean $(DISTCLEANFLAGS)
rm -rf setup*.exe
clean-coverage:
rm -rf bisect*.out
# build the usual development packages
.PHONY: build
build:
dune build
# run unit tests for package lwt
.PHONY: test
test: build
dune runtest -j 1 --no-buffer
# Install dependencies needed during development.
.PHONY : dev-deps
dev-deps :
opam install . --deps-only --yes
# Use Dune+odoc to generate static html documentation.
# Currently requires ocaml 4.03.0 to install odoc.
.PHONY: doc
doc:
dune build @doc
# Build HTML documentation with ocamldoc
.PHONY: doc-api-html
doc-api-html: build
$(MAKE) -C docs api/html/index.html
# Build wiki documentation with wikidoc
# requires ocaml 4.03.0 and pinning the repo
# https://github.com/ocsigen/wikidoc
.PHONY: doc-api-wiki
doc-api-wiki: build
$(MAKE) -C docs api/wiki/index.wiki
# Packaging tests. These are run with Lwt installed by OPAM, typically during
# CI. To run locally, run the install-for-packaging-test target first.
.PHONY: packaging-test
packaging-test:
ocamlfind query lwt
for TEST in `ls -d test/packaging/*/*` ; \
do \
$(MAKE) -wC $$TEST || exit 1 ; \
echo ; \
echo ; \
done
.PHONY: install-for-packaging-test
install-for-packaging-test: clean
opam pin add --yes --no-action lwt .
opam pin add --yes --no-action lwt_ppx .
opam pin add --yes --no-action lwt_react .
opam reinstall --yes lwt lwt_ppx lwt_react
.PHONY: uninstall-after-packaging-test
uninstall-after-packaging-test:
opam remove --yes lwt lwt_ppx lwt_react
opam pin remove --yes lwt
opam pin remove --yes lwt_ppx
opam pin remove --yes lwt_react
# ppx_let integration test.
.PHONY : ppx_let-test
ppx_let-test :
dune build test/ppx_let/test.exe
dune exec test/ppx_let/test.exe
.PHONY : ppx_let-test-deps
ppx_let-test-deps :
opam install --yes --unset-root ppx_let
.PHONY: clean
clean:
dune clean
find . -name '.merlin' | xargs rm -f
rm -fr docs/api
rm -f src/jbuild-ignore src/unix/lwt_config
for TEST in `ls -d test/packaging/*/*` ; \
do \
$(MAKE) -wC $$TEST clean ; \
done
rm -rf _coverage/
configure: $(SETUP)
./$(SETUP) -configure $(CONFIGUREFLAGS)
BISECT_FILES_PATTERN := _build/default/test/*/bisect*.out
setup.data: $(SETUP)
./$(SETUP) -configure $(CONFIGUREFLAGS)
coverage: test
bisect-ppx-report -I _build/ -html _coverage/ bisect*.out
bisect-ppx-report -text - -summary-only bisect*.out
.PHONY: coverage
coverage: clean
BISECT_ENABLE=yes $(MAKE) build
BISECT_ENABLE=yes dune runtest -j 1 --no-buffer
bisect-ppx-report \
-I _build/default/ --html _coverage/ \
--text - --summary-only \
$(BISECT_FILES_PATTERN)
@echo See _coverage/index.html
.PHONY: default setup build doc test all install uninstall reinstall clean distclean configure coverage
# Lwt &nbsp;&nbsp; [![version 2.7.1][version]][releases] [![LGPL][license-img]][copying] [![Gitter chat][gitter-img]][gitter] [![Travis status][travis-img]][travis] [![AppVeyor status][appveyor-img]][appveyor]
# Lwt &nbsp;&nbsp; [![version 4.3.0][version]][releases] [![Gitter chat][gitter-img]][gitter] [![Travis status][travis-img]][travis] [![AppVeyor status][appveyor-img]][appveyor]
[version]: https://img.shields.io/badge/version-2.7.1-blue.svg
[version]: https://img.shields.io/badge/version-4.3.0-blue.svg
[releases]: https://github.com/ocsigen/lwt/releases
[license-img]: https://img.shields.io/badge/license-LGPL-blue.svg
[gitter-img]: https://img.shields.io/badge/chat-on_gitter-lightgrey.svg
[travis]: https://travis-ci.org/ocsigen/lwt/branches
[travis-img]: https://img.shields.io/travis/ocsigen/lwt/master.svg?label=travis
......@@ -25,7 +24,7 @@ if the request is not completed in five seconds:
let () =
let request =
let%lwt addresses = Lwt_unix.getaddrinfo "google.com" "80" [] in
let google = (List.hd addresses).Lwt_unix.ai_addr in
let google = Lwt_unix.((List.hd addresses).ai_addr) in
Lwt_io.(with_connection google (fun (incoming, outgoing) ->
let%lwt () = write outgoing "GET / HTTP/1.1\r\n" in
......@@ -43,7 +42,7 @@ let () =
| Some response -> print_string response
| None -> prerr_endline "Request timed out"; exit 1
(* ocamlfind opt -package lwt.unix -package lwt.ppx -linkpkg -o request example.ml
(* ocamlfind opt -package lwt.unix -package lwt_ppx -linkpkg -o request example.ml
./request *)
```
......@@ -56,74 +55,142 @@ the visible OCaml code is run in a single thread, but Lwt internally uses a
combination of worker threads and non-blocking file descriptors to resolve in
parallel the promises that do I/O.
<br/>
### Overview
Lwt compiles to native code on Linux, macOS, Windows, and other systems. It's
also routinely compiled to JavaScript for the front end and Node, by js_of_ocaml
and BuckleScript.
In Lwt,
- The [core library `Lwt`][core] provides promises...
- ...and a few pure-OCaml helpers, such as promise-friendly [mutexes][mutex],
[condition variables][cond], and [mvars][mvar].
- There is a big Unix binding, [`Lwt_unix`][unix] that binds almost every Unix
system call. A higher-level module [`Lwt_io`][io] provides nice I/O channels.
- [`Lwt_process`][process] is for subprocess handling.
- [`Lwt_preemptive`][preemptive] spawns system threads.
- The [PPX syntax][ppx] allows using all of the above without going crazy!
- There are also some other helpers, such as [`Lwt_react`][react] for reactive
programming. See the table of contents on the linked manual pages!
[core]: https://ocsigen.org/lwt/api/Lwt
[cond]: https://ocsigen.org/lwt/api/Lwt_condition
[mutex]: https://ocsigen.org/lwt/api/Lwt_mutex
[mvar]: https://ocsigen.org/lwt/api/Lwt_mvar
[unix]: https://ocsigen.org/lwt/api/Lwt_unix
[io]: https://ocsigen.org/lwt/api/Lwt_io
[process]: https://ocsigen.org/lwt/api/Lwt_process
[preemptive]: https://ocsigen.org/lwt/api/Lwt_preemptive
[ppx]: https://ocsigen.org/lwt/api/Ppx_lwt
[react]: https://ocsigen.org/lwt/api/Lwt_react
<br/>
## Installing
```
opam install lwt
```
1. Use your system package manager to install a development libev package.
It is often called `libev-dev` or `libev-devel`.
2. `opam install conf-libev lwt`
<br/>
## Documentation
The manual can be found [here][manual]. There are also some examples available
in [`doc/examples`][examples].
We are currently working on improving the Lwt documentation (drastically; we are
rewriting the manual). In the meantime:
- The current manual can be found [here][manual].
- Mirage has a nicely-written [Lwt tutorial][mirage-tutorial].
- An example of a [simple server][counter-server] written in Lwt.
- [Concurrent Programming with Lwt][rwo-lwt] is a nice source of Lwt examples.
They are translations of code from the excellent Real World OCaml, but are
just as useful if you are not reading the book.
*Note: much of the current manual refers to `'a Lwt.t` as "lightweight threads"
or just "threads." This will be fixed in the new manual. `'a Lwt.t` is a
promise, and has nothing to do with system or preemptive threads.*
*Note: much of the manual still refers to `'a Lwt.t` as "lightweight threads" or
just "threads." This will be fixed in the new manual. `'a Lwt.t` is a promise,
and has nothing to do with system or preemptive threads.*
[manual]: http://ocsigen.org/lwt/
[rwo-lwt]: https://github.com/dkim/rwo-lwt#readme
[mirage-tutorial]: https://mirage.io/wiki/tutorial-lwt
[counter-server]: http://www.baturin.org/code/lwt-counter-server/
[manual]: http://ocsigen.org/lwt/manual/
[examples]: https://github.com/ocsigen/lwt/tree/master/doc/examples
<br/>
## Contact
Open an [issue][issues], visit [Gitter][gitter] chat, [email][email] the
maintainer, or ask in [#ocaml][irc]. If you think enough people will be
interested in the answer, it is also possible to ask on [Stack Overflow][so].
Open an [issue][issues], visit [Gitter][gitter] chat, ask in [#ocaml][irc],
on [discuss.ocaml.org][discourse], or on [Stack Overflow][so]. Please do ask!
Even apparently simple questions often end up educating other users, not to
mention enlightening the maintainers!
Subscribe to the [announcements issue][announcements] to get news about Lwt
releases. It is less noisy than watching the whole repository. Announcements are
also made in [/r/ocaml][reddit] and on the [OCaml mailing list][caml-list].
Release announcements are made in [/r/ocaml][reddit], and on
[discuss.ocaml.org][discourse]. Watching the repo for "Releases only" is also an
option.
[issues]: https://github.com/ocsigen/lwt/issues/new
[gitter]: https://gitter.im/ocaml-lwt/Lobby
[email]: mailto:antonbachin@yahoo.com
[irc]: http://webchat.freenode.net/?channels=#ocaml
[so]: http://stackoverflow.com/questions/ask?tags=ocaml,lwt,ocaml-lwt
[announcements]: https://github.com/ocsigen/lwt/issues/309
[reddit]: https://www.reddit.com/r/ocaml/
[caml-list]: https://sympa.inria.fr/sympa/arc/caml-list
[discourse]: https://discuss.ocaml.org/c/lwt
[issues]: https://github.com/ocsigen/lwt/issues/new
<br/>
## Contributing
Lwt is a very mature library, but there is considerable room for improvement.
Contributions are welcome. To clone the source and install a development
version,
```
opam source --dev-repo --pin lwt
```
This will also install the development dependency OASIS.
A list of [project suggestions][projects] and a [roadmap][roadmap] can be found
on the wiki.
- We maintain [easy starter issues][easy-issues]. These are thoroughly explained
and hyperlinked. We hope that this makes working on Lwt accessible even to
relative OCaml beginners :)
- [`CONTRIBUTING.md`][contributing-md] contains tips for working on the code,
such as how to check the code out, how review works, etc. There is also a
high-level outline of the code base.
- The overall development plan can be found in the [roadmap][roadmap].
- [Ask](#contact) us anything, whether it's about working on Lwt, or any
question at all about it :)
- The [documentation](#documentation) always needs proofreading and fixes.
- Despite a lot of progress, Lwt still needs [more tests][testing-issues].
- You are welcome to pick up any other [issue][issues-and-prs], review a PR, add
your opinion, etc.
- Any feedback is welcome, including how to make contributing easier!
[issues-and-prs]: https://github.com/ocsigen/lwt/issues?utf8=%E2%9C%93&q=is%3Aopen
[all-issues]: https://github.com/ocsigen/lwt/issues
[roadmap]: https://github.com/ocsigen/lwt/wiki/Roadmap
[easy-issues]: https://github.com/ocsigen/lwt/labels/easy
[contributing-md]: https://github.com/ocsigen/lwt/blob/master/docs/CONTRIBUTING.md#readme
[testing-issues]: https://github.com/ocsigen/lwt/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20label%3Aeasy%20test
[projects]: https://github.com/ocsigen/lwt/wiki/Plan#projects
[roadmap]: https://github.com/ocsigen/lwt/wiki/Plan#roadmap
<br/>
## License
Lwt is released under the LGPL, with the OpenSSL linking exception. See
[`COPYING`][copying].
[copying]: https://github.com/ocsigen/lwt/blob/master/doc/COPYING
## Libraries to use with Lwt
- [alcotest](https://github.com/mirage/alcotest/)
unit testing
- [angstrom](https://github.com/inhabitedtype/angstrom)
parser combinators
- [cohttp](https://github.com/mirage/ocaml-cohttp) — HTTP client and server
- [cstruct](https://github.com/mirage/ocaml-cstruct)
interop with C-like structures
- [ezjsonm](https://github.com/mirage/ezjsonm)
JSON parsing and output
- [faraday](https://github.com/inhabitedtype/faraday)
serialization combinators
- [logs](https://github.com/dbuenzli/logs)
logging
- [lwt-parallel](https://github.com/ivg/parallel)
distributed computing
- [mwt](https://github.com/hcarty/mwt) — preemptive (system) thread pools
- [opium](https://github.com/rgrinberg/opium)
web framework
This diff is collapsed.
version: "{build}"
shallow_clone: true
environment:
global:
ARCH: x86_64
LWT_FORCE_LIBEV_BY_DEFAULT: yes
# Uncomment to debug build with RDP. Alternatively, create the file
# appveyor-debug in the repository root. The latter option avoids
# invalidating the AppVeyor dependency cache.
# LWT_APPVEYOR_DEBUG: yes
install:
- 'IF EXIST C:\projects\lwt\appveyor-debug (SET LWT_APPVEYOR_DEBUG=yes)'
- 'IF "%ARCH%"=="x86" (SET CYGSH=C:\Cygwin\bin\bash -lc) ELSE (SET CYGSH=C:\Cygwin64\bin\bash -lc)'
- 'IF "%ARCH%"=="x86" (SET CYGSETUP=C:\Cygwin\setup-x86) ELSE (SET CYGSETUP=C:\Cygwin64\setup-x86_64)'
- 'IF "%LWT_APPVEYOR_DEBUG%"=="yes" (%CYGSETUP% -q -P nano)'
- '%CYGSETUP% -q -P rsync -P patch -P diffutils -P make -P unzip -P m4'
- 'IF "%LIBEV%"=="yes" (%CYGSETUP% -q -P libev-devel)'
- '%CYGSH% "wget https://github.com/fdopen/opam-repository-mingw/releases/download/0.0.0.2/opam64.tar.xz"'
- '%CYGSH% "tar -xf opam64.tar.xz"'
- '%CYGSH% "bash opam64/install.sh"'
- '%CYGSH% "opam init default https://github.com/fdopen/opam-repository-mingw.git#opam2 -c ocaml-variants.4.07.1+mingw64c --disable-sandboxing --yes --auto-setup"'
- '%CYGSH% "cd /cygdrive/c/projects/lwt ; src/util/appveyor-install.sh"'
build_script:
- '%CYGSH% "cd /cygdrive/c/projects/lwt ; src/util/appveyor-build.sh"'
cache:
- '..\opam-cache-%SYSTEM%-%COMPILER%-%LIBEV%.tar -> lwt*.opam, appveyor.yml, src\util\appveyor*.sh'
on_finish:
- ps: 'if ($env:LWT_APPVEYOR_DEBUG -eq "yes") { $blockRdp = $true; iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1")) }'
lwt (2.7.1-8) UNRELEASED; urgency=medium
lwt (4.3.0-1) UNRELEASED; urgency=medium
* Fix FTBFS with OCaml 4.08.0
* New upstream release
- SSL bindings have been moved to a different package, drop binary
packages liblwt-ssl-ocaml{,-dev}
- drop liblwt-ocaml-doc which has been empty for a while
-- Stéphane Glondu <glondu@debian.org> Sun, 01 Sep 2019 06:32:05 +0200
-- Stéphane Glondu <glondu@debian.org> Wed, 11 Sep 2019 15:16:45 +0200
lwt (2.7.1-7) unstable; urgency=medium
......
debian/liblwt-glib-ocaml-dev.install
debian/liblwt-glib-ocaml.install
debian/liblwt-ocaml.install
debian/liblwt-ssl-ocaml-dev.install
debian/liblwt-ssl-ocaml.install
_tmp/
......@@ -7,18 +7,18 @@ Build-Depends:
dh-ocaml (>= 0.9),
libev-dev,
ocaml-findlib (>= 1.4),
ocamlbuild,
ocaml-dune,
opam-installer,
libdune-ocaml-dev,
cppo,
libfindlib-ocaml-dev,
libssl-ocaml-dev (>= 0.5),
libreact-ocaml-dev (>= 0.9.1-1~),
libresult-ocaml-dev,
libmmap-ocaml-dev,
libppx-tools-ocaml-dev,
libppx-tools-versioned-ocaml-dev,
libocplib-endian-ocaml-dev,
ocaml-compiler-libs,
ocaml-nox (>= 4),
# Needed for debian/modules.ml script
libpcre-ocaml-dev
ocaml-nox (>= 4.08)
Standards-Version: 4.4.0
Section: ocaml
Homepage: http://ocsigen.org/lwt
......@@ -65,61 +65,3 @@ Description: cooperative light-weight thread library for OCaml (runtime)
announce that it wants to let the others run.
.
This package contains runtime libraries for programs using core Lwt.
Package: liblwt-ssl-ocaml-dev
Architecture: any
Depends:
${ocaml:Depends},
${shlibs:Depends},
${misc:Depends}
Provides: ${ocaml:Provides}
Replaces: liblwt-ocaml-dev (<= 2.3.0)
Breaks: liblwt-ocaml-dev (<= 2.3.0)
Recommends:
liblwt-ocaml-doc,
ocaml-findlib
Description: cooperative OpenSSL bindings for OCaml
Lwt is a library for cooperative threads implemented in a monadic style.
Unlike preemptive threads, cooperative threads do not use a scheduler to
distribute processor time between threads. Instead, each thread must
announce that it wants to let the others run.
.
This package contains all the development stuff you need to use Lwt
with cooperative OpenSSL in your programs.
Package: liblwt-ssl-ocaml
Architecture: any
Depends:
${ocaml:Depends},
${shlibs:Depends},
${misc:Depends}
Provides: ${ocaml:Provides}
Replaces: liblwt-ocaml-dev (<= 2.3.0)
Breaks: liblwt-ocaml-dev (<= 2.3.0)
Description: cooperative OpenSSL bindings for OCaml (runtime)
Lwt is a library for cooperative threads implemented in a monadic style.
Unlike preemptive threads, cooperative threads do not use a scheduler to
distribute processor time between threads. Instead, each thread must
announce that it wants to let the others run.
.
This package contains runtime libraries for programs using Lwt with
cooperative OpenSSL.
Package: liblwt-ocaml-doc
Section: doc
Architecture: all
Enhances:
liblwt-ocaml-dev,
liblwt-ssl-ocaml-dev,
liblwt-glib-ocaml-dev
Depends: ${misc:Depends}
Replaces: liblwt-ocaml-dev (<= 2.3.0)
Breaks: liblwt-ocaml-dev (<= 2.3.0)
Description: cooperative light-weight thread library (documentation)
Lwt is a library for cooperative threads implemented in a monadic style.
Unlike preemptive threads, cooperative threads do not use a scheduler to
distribute processor time between threads. Instead, each thread must
announce that it wants to let the others run.
.
This package contains the complete API reference for Lwt, including
OpenSSL, GLib bindings, and examples.
......@@ -5,70 +5,10 @@ Source: http://ocsigen.org/lwt/
Upstream-Contact: The Ocsigen Team <dev@ocsigen.org>
Files: *
Copyright: 1999-2013, Jérôme Vouillon and others
License: LGPL-2.1-exception
This program is released under the LGPL version 2.1 with the
additional exemption that compiling, linking, and/or using OpenSSL
is allowed.
.
As a special exception to the GNU Library General Public License,
you may also link, statically or dynamically, a "work that uses the
Library" with a publicly distributed version of the Library to
produce an executable file containing portions of the Library, and
distribute that executable file under terms of your choice, without
any of the additional requirements listed in clause 6 of the GNU
Library General Public License. By "a publicly distributed version
of the Library", we mean either the unmodified Library, or a
modified version of the Library that is distributed under the
conditions defined in clause 3 of the GNU Library General Public
License. This exception does not however invalidate any other
reasons why the executable file might be covered by the GNU Library
General Public License.
.
The complete text of the GNU Lesser General Public License can be
found in `/usr/share/common-licenses/LGPL-2.1'.
.
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
Copyright: 1999-2019, the Authors of Lwt
License: MIT
Files: doc/examples/*
Copyright: 2009, Jérémie Dimino <jeremie@dimino.org>
License: BSD-C3
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Jeremie Dimino nor the names of his
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Files: src/core/lwt_mvar.ml*
Files: src/core/lwt_mvar.ml* src/core/lwt_condition.ml*
Copyright: 2009, Metaweb Technologies, Inc
License: BSD-C2
All rights reserved.
......@@ -95,8 +35,24 @@ License: BSD-C2
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Files: debian/*
Copyright: 2008-2013, Stéphane Glondu <steph@glondu.net>
License: LGPL-2.1
The Debian packaging is released under the GNU Lesser General Public
License version 2.1 or later. Its complete text can be found in
`/usr/share/common-licenses/LGPL-2.1'.
Copyright: 2008-2019, Stéphane Glondu
License: MIT
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
/usr/bin/ppx_lwt
@OCamlStdlibDir@/lwt/lwt_config.h
@OCamlStdlibDir@/lwt/lwt_unix.h
@OCamlStdlibDir@/lwt/lwt_log_rules.mli
@OCamlStdlibDir@/lwt/lwt_log_rules.cmi
@OCamlStdlibDir@/lwt/lwt_log_rules.cmt
@OCamlStdlibDir@/lwt/lwt_log_rules.cmti
@OCamlStdlibDir@/lwt/lwt_log_rules.annot
@OCamlStdlibDir@/lwt/*dune*
@OCamlStdlibDir@/lwt/*opam*
@OCamlStdlibDir@/lwt/*.ml*
@OCamlStdlibDir@/lwt/*.cmi
@OCamlStdlibDir@/lwt/*.cmt*
OPT: @OCamlStdlibDir@/lwt/*.a
OPT: @OCamlStdlibDir@/lwt/*.cmx
OPT: @OCamlStdlibDir@/lwt/*.cmxa
@OCamlStdlibDir@/lwt/unix/*.h
@OCamlStdlibDir@/lwt/unix/*.ml*
@OCamlStdlibDir@/lwt/unix/*.cmi
@OCamlStdlibDir@/lwt/unix/*.cmt*
@OCamlStdlibDir@/lwt/unix/*.a
OPT: @OCamlStdlibDir@/lwt/unix/*.cmx
OPT: @OCamlStdlibDir@/lwt/unix/*.cmxa
@OCamlStdlibDir@/lwt_ppx
@OCamlStdlibDir@/lwt_react/*dune*
@OCamlStdlibDir@/lwt_react/*opam*
@OCamlStdlibDir@/lwt_react/*.ml*
@OCamlStdlibDir@/lwt_react/*.cmi
@OCamlStdlibDir@/lwt_react/*.cmt*
OPT: @OCamlStdlibDir@/lwt_react/*.cmx
OPT: @OCamlStdlibDir@/lwt_react/*.cmxa
OPT: @OCamlStdlibDir@/lwt_react/*.a
@OCamlDllDir@
@OCamlStdlibDir@/lwt/META
@OCamlStdlibDir@/lwt/*.cma
DYN: @OCamlStdlibDir@/lwt/*.cmxs
@OCamlStdlibDir@/lwt/unix/*.cma
DYN: @OCamlStdlibDir@/lwt/unix/*.cmxs
@OCamlStdlibDir@/lwt_react/META
@OCamlStdlibDir@/lwt_react/*.cma
DYN: @OCamlStdlibDir@/lwt_react/*.cmxs
(* This script fills in debian/*.install files, based on dispatching
of *.cma files. *)
#use "topfind";;
#require "unix";;
#require "pcre";;
let dll_dir = Sys.getenv "OCAML_DLL_DIR"
let is_native = Sys.getenv "OCAML_HAVE_OCAMLOPT" = "yes"
let has_natdynlink = Sys.getenv "OCAML_NATDYNLINK" = "yes"
let dh_verbose =
if (try Sys.getenv "DH_VERBOSE" = "1" with Not_found -> false) then
(fun fmt -> Printf.printf fmt)
else
(fun fmt -> Printf.ifprintf stderr fmt)
let is_private = function
| "Pa_lwt_options"
| "Lwt_log_rules"
| "Lwt_ocaml_completion"
| "Lwt_simple_top"
| "Lwt_unix_jobs_generated"
| "Lwt_config"
-> true
| _ -> false
let suffix = function
| "lwt-glib" -> "-glib"
| "lwt-react" -> ""
| "lwt-ssl" -> "-ssl"
| "lwt-extra" -> ""
| "lwt-syntax-log" -> ""
| "lwt-text" -> ""
| "lwt-syntax-options" -> ""
| "lwt-unix" -> ""
| "lwt-syntax" -> ""
| "lwt-top" -> ""
| "lwt-preemptive" -> ""
| "lwt-simple-top" -> ""
| "lwt" -> ""
| "ppx" -> ""
| "lwt-log" -> ""
| _ -> assert false
let chop_prefix x =
let n = String.length x in
assert (n > 10 && String.sub x 0 10 = "debian/tmp");
String.sub x 10 (n-10)
exception Objinfo_error of string * Unix.process_status
let split_dll =
let rex = Pcre.regexp " *-l" in
fun line -> List.tl (Pcre.split ~rex line)
let print_cma cma =
let component = suffix (Filename.chop_suffix (Filename.basename cma) ".cma") in
let () = dh_verbose "Generating module data for %s, going to lwt%s...\n%!" cma component in
let flags = [Open_creat; Open_append] in
let dev = open_out_gen flags 0o644 (Printf.sprintf "debian/liblwt%s-ocaml-dev.install" component) in
let runtime = open_out_gen flags 0o644 (Printf.sprintf "debian/liblwt%s-ocaml.install" component) in
let () = Printf.fprintf runtime "%s\n" (chop_prefix cma) in
let () =
let x = Filename.chop_suffix cma ".cma" in
if is_native then (
Printf.fprintf dev "%s\n" (chop_prefix x ^ ".cmxa");
Printf.fprintf dev "%s\n" (chop_prefix x ^ ".a");
);
if has_natdynlink then (
Printf.fprintf runtime "%s\n" (chop_prefix x ^ ".cmxs");
);
in
let dlls, modules =
let objinfo = Printf.ksprintf Unix.open_process_in "ocamlobjinfo %s | sed -nr 's/^(Unit name|Extra dynamically.*): //p'" cma in
let close () = match Unix.close_process_in objinfo with
| Unix.WEXITED 0 -> ()
| r -> raise (Objinfo_error (cma, r))
in
let rec slurp accu =
match (try Some (input_line objinfo) with End_of_file -> close (); None) with
| Some x -> slurp (x::accu)
| None -> accu
in match List.rev (slurp []) with
| x::xs when String.length x > 1 && x.[0] = '-' -> split_dll x, xs
| xs -> [], xs
in
let dirname = Filename.dirname cma in
let print_module mname =
let m = Filename.concat dirname (String.uncapitalize_ascii mname) in
if is_native then Printf.fprintf dev "%s\n" (chop_prefix (m^".cmx"));
if not (is_private mname) then (
Printf.fprintf dev "%s\n" (chop_prefix (m^".cmi"));
Printf.fprintf dev "%s\n" (chop_prefix (m^".mli"));
Printf.fprintf dev "%s\n" (chop_prefix (m^".cmt"));
Printf.fprintf dev "%s\n" (chop_prefix (m^".cmti"));
Printf.fprintf dev "%s\n" (chop_prefix (m^".annot"));
)
in
let print_dll m =
let b = chop_prefix dirname in
Printf.fprintf runtime "%s %s\n" (Filename.concat b ("dll"^m^".so")) dll_dir;
Printf.fprintf dev "%s\n" (Filename.concat b ("lib"^m^".a"))
in
List.iter print_module modules;
List.iter print_dll dlls;
close_out dev;
close_out runtime
;;
let find_cmas dir =
let ic = Printf.ksprintf Unix.open_process_in "find %s -name '*.cma'" dir in
let rec loop accu =
match input_line ic with
| exception End_of_file -> accu
| line -> loop (line :: accu)
in
let r = loop [] in
match Unix.close_process_in ic with
| Unix.WEXITED 0 -> r
| _ -> failwith "find failed"
;;
List.iter print_cma (find_cmas "debian/tmp");;
From: Stephane Glondu <steph@glondu.net>
Date: Thu, 12 Oct 2017 09:24:11 +0200
Subject: Fix installation on bytecode architectures
Bug-Debian: https://bugs.debian.org/878236
---
setup.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.ml b/setup.ml
index 50f5804..34cfb07 100644
--- a/setup.ml
+++ b/setup.ml
@@ -2449,7 +2449,7 @@ module OASISLibrary = struct
if bs.bs_c_sources <> [] then begin
["lib"^cs.cs_name^"_stubs"^ext_lib]
::
- if has_native_dynlink then
+ if true || has_native_dynlink then
["dll"^cs.cs_name^"_stubs"^ext_dll] :: acc_nopath
else
acc_nopath
From: Stephane Glondu <steph@glondu.net>
Date: Mon, 16 Oct 2017 10:31:23 +0200
Subject: Disable two tests that hang or fail on arm64
Bug-Debian: https://bugs.debian.org/878495
---
tests/unix/test_lwt_io.ml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/unix/test_lwt_io.ml b/tests/unix/test_lwt_io.ml
index ba59994..34dd91e 100644
--- a/tests/unix/test_lwt_io.ml
+++ b/tests/unix/test_lwt_io.ml
@@ -160,6 +160,7 @@ let suite = suite "lwt_io" [
Lwt.return (!sent = [Bytes.of_string "foobar"]))
oc);
+(*
(* Without the corresponding bugfix, which is to handle ENOTCONN from
Lwt_unix.shutdown, this test raises an exception from the handler's calls
to close. *)
@@ -185,6 +186,7 @@ let suite = suite "lwt_io" [
Lwt.wakeup client_finished ();
Lwt_io.Versioned.shutdown_server_2 server >>= fun () ->
handler);
+*)
(* Counterpart to establish_server: shutdown test. Confirms that shutdown is
implemented correctly in open_connection. *)
@@ -332,6 +334,7 @@ let suite = suite "lwt_io" [
run >|= fun () ->
!exceptions_observed = 2);
+(*
(* Screws up the open sockets so closing them fails with EBADF. Then, raises
an exception from the handler. Checks that the handler exception arrives
at Lwt.async_exception_hook before the exceptions from implicit close. *)
@@ -359,6 +362,7 @@ let suite = suite "lwt_io" [
with_async_exception_hook see_exception run >|= fun () ->
!exceptions_observed = 3 && !correct_exceptions);
+*)
test "with_connection"
(fun () ->
From: Stephane Glondu <steph@glondu.net>
Date: Sun, 1 Sep 2019 06:29:18 +0200
Subject: Fix FTBFS with OCaml 4.08.0
---
_tags | 4 ++++
src/core/META | 2 +-
src/ssl/lwt_ssl.mli | 4 ++--
src/unix/lwt_bytes.ml | 2 +-
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/_tags b/_tags
index fbae8ec..2d5521c 100644
--- a/_tags
+++ b/_tags
@@ -66,6 +66,7 @@ true: annot, bin_annot
<src/unix/*.ml{,i,y}>: package(bytes)
<src/unix/*.ml{,i,y}>: package(result)
<src/unix/*.ml{,i,y}>: package(unix)
+<src/unix/*.ml{,i,y}>: package(mmap)
<src/unix/*.ml{,i,y}>: use_lwt
<src/unix/*.ml{,i,y}>: use_lwt-log
"src/unix/lwt_unix_stubs.c": package(bigarray)
@@ -304,6 +305,7 @@ true: annot, bin_annot
<doc/examples/unix/logging.{native,byte}>: package(bytes)
<doc/examples/unix/logging.{native,byte}>: package(result)
<doc/examples/unix/logging.{native,byte}>: package(unix)
+<doc/examples/unix/logging.{native,byte}>: package(mmap)
<doc/examples/unix/logging.{native,byte}>: use_lwt
<doc/examples/unix/logging.{native,byte}>: use_lwt-log
<doc/examples/unix/logging.{native,byte}>: use_lwt-unix
@@ -313,6 +315,7 @@ true: annot, bin_annot
<doc/examples/unix/relay.{native,byte}>: package(bytes)
<doc/examples/unix/relay.{native,byte}>: package(result)
<doc/examples/unix/relay.{native,byte}>: package(unix)
+<doc/examples/unix/relay.{native,byte}>: package(mmap)
<doc/examples/unix/relay.{native,byte}>: use_lwt
<doc/examples/unix/relay.{native,byte}>: use_lwt-log
<doc/examples/unix/relay.{native,byte}>: use_lwt-unix
@@ -322,6 +325,7 @@ true: annot, bin_annot
<doc/examples/unix/parallelize.{native,byte}>: package(bytes)
<doc/examples/unix/parallelize.{native,byte}>: package(result)
<doc/examples/unix/parallelize.{native,byte}>: package(unix)
+<doc/examples/unix/parallelize.{native,byte}>: package(mmap)
<doc/examples/unix/parallelize.{native,byte}>: use_lwt
<doc/examples/unix/parallelize.{native,byte}>: use_lwt-log
<doc/examples/unix/parallelize.{native,byte}>: use_lwt-unix
diff --git a/src/core/META b/src/core/META
index 676f7de..24d0eaf 100644
--- a/src/core/META
+++ b/src/core/META
@@ -11,7 +11,7 @@ exists_if = "lwt.cma"
package "unix" (
version = "2.7.1"
description = "Unix support for Lwt"
- requires = "lwt lwt.log unix bigarray"
+ requires = "lwt lwt.log unix bigarray mmap"
archive(byte) = "lwt-unix.cma"
archive(byte, plugin) = "lwt-unix.cma"
archive(native) = "lwt-unix.cmxa"
diff --git a/src/ssl/lwt_ssl.mli b/src/ssl/lwt_ssl.mli
index df1156d..3b23f55 100644
--- a/src/ssl/lwt_ssl.mli
+++ b/src/ssl/lwt_ssl.mli
@@ -59,8 +59,8 @@ val ssl_perform_handshake : uninitialized_socket -> socket Lwt.t
val ssl_accept_handshake : uninitialized_socket -> socket Lwt.t
(** Await a SSL/TLS handshake on the specified socket (used by servers). *)
-val read : socket -> string -> int -> int -> int Lwt.t
-val write : socket -> string -> int -> int -> int Lwt.t
+val read : socket -> bytes -> int -> int -> int Lwt.t
+val write : socket -> bytes -> int -> int -> int Lwt.t
val read_bytes : socket -> Lwt_bytes.t -> int -> int -> int Lwt.t
val write_bytes : socket -> Lwt_bytes.t -> int -> int -> int Lwt.t
diff --git a/src/unix/lwt_bytes.ml b/src/unix/lwt_bytes.ml
index 082febb..8e6675f 100644
--- a/src/unix/lwt_bytes.ml
+++ b/src/unix/lwt_bytes.ml
@@ -223,7 +223,7 @@ let sendto fd buf pos len flags addr =
+-----------------------------------------------------------------+ *)
let map_file ~fd ?pos ~shared ?(size=(-1)) () =
- Array1.map_file fd ?pos char c_layout shared size
+ Mmap.V1.map_file fd ?pos char c_layout shared [|size|] |> Bigarray.array1_of_genarray
[@@ocaml.warning "-3"]
(* BigArray.Array1.map_file is deprecated in OCaml 4.05; however, the
suggested replacement requires 4.05 (Lwt still supports 4.02). The