Skip to content

Commit eafe436

Browse files
committed
Fix semaphore bug in basement
1 parent 0a2af65 commit eafe436

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,23 @@ jobs:
6868
6969
export OPAMYES=1
7070
export OPAMJOBS=$(($(nproc) + 2))
71-
export CC=musl-gcc
7271
echo "OPAMYES=1" >> "$GITHUB_ENV"
7372
echo "OPAMJOBS=$OPAMJOBS" >> "$GITHUB_ENV"
7473
7574
opam init --bare -yav https://github.com/ocaml/opam-repository.git
7675
opam switch set ${{ matrix.ocaml-version }} 2>/dev/null || \
7776
opam switch create ${{ matrix.ocaml-version }} --repos ox=git+https://github.com/oxcaml/opam-repository.git,default
77+
78+
- name: Vendor Basement
79+
run: |
80+
mkdir ../basement
81+
curl -L 'https://github.com/janestreet/basement/archive/c657898128a97dcdfbe4b25d79fd0de2e1e5218f.tar.gz' | \
82+
tar -C ../basement -xz --strip-components=1
83+
git -C ../basement apply $PWD/vendor/basement-semaphore-bug-fix.patch
84+
opam pin basement ../basement
85+
86+
- name: Vendor Core_unix
87+
run: |
7888
mkdir ../core_unix
7989
curl -L 'https://github.com/janestreet/core_unix/archive/63390a3f75376156e77ed49d6cc07ca48a90dd53.tar.gz' | \
8090
tar -C ../core_unix -xz --strip-components=1
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
commit 16d35743d6b52bc0b38702a459025ba82bd8811f
2+
Author: Fake Name <fake@gmail.com>
3+
Date: Thu Dec 11 03:26:20 2025 +0000
4+
5+
Fix bug where `sem_close` was being called on an unnamed semaphore
6+
7+
diff --git a/src/blocking_mutex.h b/src/blocking_mutex.h
8+
index b1d01df..c4658e3 100644
9+
--- a/src/blocking_mutex.h
10+
+++ b/src/blocking_mutex.h
11+
@@ -106,7 +106,7 @@ Caml_inline int blocking_mutex_destroy(blocking_mutex mut) {
12+
caml_stat_free(mut);
13+
return MUTEX_SUCCESS;
14+
#else
15+
- if (sem_close(&mut->sem) == MUTEX_SUCCESS) {
16+
+ if (sem_destroy(&mut->sem) == MUTEX_SUCCESS) {
17+
caml_stat_free(mut);
18+
return MUTEX_SUCCESS;
19+
}

0 commit comments

Comments
 (0)