# \#threading

**URL:** https://discuss.ocaml.org/tag/threading/407.md

[Latest](https://discuss.ocaml.org/latest.md) · [Categories](https://discuss.ocaml.org/categories.md) · [Tags](https://discuss.ocaml.org/tags.md)

---

## [System threads in the era of multicore Ocaml?](https://discuss.ocaml.org/t/system-threads-in-the-era-of-multicore-ocaml/17016)

<div class="topic-metadata">

**Author:** [@buzmeg](https://discuss.ocaml.org/u/buzmeg)\
**Replies:** 3\
**Last updated:** [July 27, 2025, 8:40am UTC](https://discuss.ocaml.org/t/system-threads-in-the-era-of-multicore-ocaml/17016 "2025-07-27T08:40:26Z")

</div>

I’m trying to do so Vulkan stuff with OCaml, but for the life of me I can’t seem to find references for multicore OCaml on how to deal with threads of execution that can block in C calls. What am I missing? Any pointer…

---

## [Interaction of effect-based fibers with caml\_release\_runtime\_system?](https://discuss.ocaml.org/t/interaction-of-effect-based-fibers-with-caml-release-runtime-system/14807)

<div class="topic-metadata">

**Author:** [@yawaramin](https://discuss.ocaml.org/u/yawaramin)\
**Replies:** 2\
**Last updated:** [June 18, 2024, 10:40am UTC](https://discuss.ocaml.org/t/interaction-of-effect-based-fibers-with-caml-release-runtime-system/14807 "2024-06-18T10:40:35Z")

</div>

I have been investigating how C library wrappers can achieve non-blocking I/O in OCaml. Here’s an example of such a wrapper (stub): postgresql-ocaml/src/postgresql\_stubs.c at c14d830d3eacd36c18ecf8d2bb93d3b92e092539 · mm…

---

## [Test caml\_state and conditionally caml\_acquire\_runtime\_system - good or bad?](https://discuss.ocaml.org/t/test-caml-state-and-conditionally-caml-acquire-runtime-system-good-or-bad/12489)

<div class="topic-metadata">

**Author:** [@rwmjones](https://discuss.ocaml.org/u/rwmjones)\
**Replies:** 9\
**Last updated:** [June 27, 2023, 3:35pm UTC](https://discuss.ocaml.org/t/test-caml-state-and-conditionally-caml-acquire-runtime-system-good-or-bad/12489 "2023-06-27T15:35:04Z")

</div>

I’m adding OCaml 5 support to an existing project. The project is just some OCaml bindings and therefore fairly easy to deal with, but it also has callbacks. In other words: OCaml -\> C binding -\> callback wrapper -\> O…

---

## [Lwt\_stream.get blocking](https://discuss.ocaml.org/t/lwt-stream-get-blocking/11833)

<div class="topic-metadata">

**Author:** [@Marchhill](https://discuss.ocaml.org/u/Marchhill)\
**Replies:** 1\
**Last updated:** [March 30, 2023, 2:37pm UTC](https://discuss.ocaml.org/t/lwt-stream-get-blocking/11833 "2023-03-30T14:37:30Z")

</div>

I am getting an object from a stream and timing it like so: let t1 = Time\_now.nanoseconds\_since\_unix\_epoch () in let\* msg\_event = Lwt\_stream.get s.msgs in let t2 = Time\_now.nanoseconds\_since\_unix\_epoch () in I also tri…

---

## [\[Q\] Does \`Thread\` module really work?](https://discuss.ocaml.org/t/q-does-thread-module-really-work/11718)

<div class="topic-metadata">

**Author:** [@anzhi0708](https://discuss.ocaml.org/u/anzhi0708)\
**Replies:** 9\
**Last updated:** [March 20, 2023, 10:41am UTC](https://discuss.ocaml.org/t/q-does-thread-module-really-work/11718 "2023-03-20T10:41:49Z")

</div>

Hello guys. I’m both a beginner in OCaml & CS, aka a noob. I wrote this piece of code to test Thread module let () = print\_endline "Hello, World!" let rec fib\_normal (n: int): int = match n with | 0 | 1 -\> n …

---

## [【Q】Why is it 0?](https://discuss.ocaml.org/t/q-why-is-it-0/11688)

<div class="topic-metadata">

**Author:** [@anzhi0708](https://discuss.ocaml.org/u/anzhi0708)\
**Replies:** 2\
**Last updated:** [March 17, 2023, 9:58am UTC](https://discuss.ocaml.org/t/q-why-is-it-0/11688 "2023-03-17T09:58:35Z")

</div>

Hello! I’m both an OCaml beginner and a CS beginner AKA a noob. I was expecting variable money’s value to equal to 0 since race condition but its value was still 0. Can someone explain? Thanks a lot :3 let money = ref…

---

## [Ocamlunix book: Ocaml systhreads](https://discuss.ocaml.org/t/ocamlunix-book-ocaml-systhreads/10452)

<div class="topic-metadata">

**Author:** [@BikalGurung](https://discuss.ocaml.org/u/BikalGurung)\
**Replies:** 5\
**Last updated:** [September 13, 2022, 8:30pm UTC](https://discuss.ocaml.org/t/ocamlunix-book-ocaml-systhreads/10452 "2022-09-13T20:30:08Z")

</div>

Hi All, I was going through the threads chapter in ocamlunix book (Threads). In it it mentions that thread Thread.t can execute in parallel to each other. Quoted below: But unlike coroutines, which pass control explic…

---

## [Using thread\_local memory in a C++ thread invoked from Multicore-OCaml](https://discuss.ocaml.org/t/using-thread-local-memory-in-a-c-thread-invoked-from-multicore-ocaml/9552)

<div class="topic-metadata">

**Author:** [@hemendra](https://discuss.ocaml.org/u/hemendra)\
**Replies:** 5\
**Last updated:** [March 30, 2022, 4:37pm UTC](https://discuss.ocaml.org/t/using-thread-local-memory-in-a-c-thread-invoked-from-multicore-ocaml/9552 "2022-03-30T16:37:54Z")

</div>

Hi folks, Is there a way to use thread\_local memory in a C++ thread invoked from Multicore-OCaml ? thread.ml external spawnThread\_O : unit -\> unit = "spawnThread\_C" let main () = let t1 = Domain.spawn (fun \_ -\> …

---

## [threading/IO monad vs threads: the case of web-app servers](https://discuss.ocaml.org/t/threading-io-monad-vs-threads-the-case-of-web-app-servers/6935)

<div class="topic-metadata">

**Author:** [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Replies:** 37\
**Last updated:** [December 20, 2020, 12:59pm UTC](https://discuss.ocaml.org/t/threading-io-monad-vs-threads-the-case-of-web-app-servers/6935 "2020-12-20T12:59:59Z")

</div>

One thing I’ve wondered off-and-on, is why all the popular web frameworks for OCaml seem to be based on monads. Back in prehistory, I remember that Gerd Stolpmann wrote an Apache plugin that linked OCaml; I remember som…
