Skip to content

Commit 6258662

Browse files
committed
fix arity for blodwen-set-thread-data
This is an update of PR #540, thanks to @lodi
1 parent 8cd265c commit 6258662

File tree

7 files changed

+67
-2
lines changed

7 files changed

+67
-2
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ ${TEST_PREFIX}/${NAME_VERSION} :
114114
ln -s ${IDRIS2_CURDIR}/libs/network/build/ttc ${TEST_PREFIX}/${NAME_VERSION}/network-${IDRIS2_VERSION}
115115
endif
116116

117+
.PHONY: ${TEST_PREFIX}/${NAME_VERSION}
118+
117119
testenv:
118120
@${MAKE} ${TEST_PREFIX}/${NAME_VERSION}
119121
@${MAKE} -C tests testbin IDRIS2=${TARGET} IDRIS2_PREFIX=${TEST_PREFIX}

support/chez/support.ss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@
257257
(define (blodwen-get-thread-data ty)
258258
(blodwen-thread-data))
259259

260-
(define (blodwen-set-thread-data a)
260+
(define (blodwen-set-thread-data ty a)
261261
(blodwen-thread-data a))
262262

263263
;; Semaphore

tests/Main.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ chezTests = MkTestPool "Chez backend" [] (Just Chez)
213213
, "chez013", "chez014", "chez015", "chez016", "chez017", "chez018"
214214
, "chez019", "chez020", "chez021", "chez022", "chez023", "chez024"
215215
, "chez025", "chez026", "chez027", "chez028", "chez029", "chez030"
216-
, "chez031", "chez032", "chez033"
216+
, "chez031", "chez032", "chez033", "chez034"
217217
, "futures001"
218218
, "bitops"
219219
, "casts"

tests/chez/chez034/ThreadData.idr

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
module Main
2+
3+
import System.Concurrency
4+
5+
child : Condition -> Mutex -> IO ()
6+
child cond mtx = do
7+
mutexAcquire mtx
8+
str <- getThreadData String
9+
putStrLn $ "child data: " ++ (show str)
10+
11+
setThreadData 17
12+
i <- getThreadData Int
13+
putStrLn $ "child data now: " ++ (show i)
14+
15+
conditionSignal cond
16+
conditionWait cond mtx
17+
18+
putStrLn $ "child exiting"
19+
20+
conditionSignal cond
21+
mutexRelease mtx
22+
23+
24+
main : IO ()
25+
main = do
26+
setThreadData 13
27+
i <- getThreadData Int
28+
putStrLn $ "parent data initialized to: " ++ (show i)
29+
30+
setThreadData "hello"
31+
str <- getThreadData String
32+
putStrLn $ "parent data now: " ++ (show str)
33+
34+
mtx <- makeMutex
35+
cond <- makeCondition
36+
37+
mutexAcquire mtx
38+
_ <- fork (child cond mtx)
39+
conditionWait cond mtx
40+
41+
str2 <- getThreadData String
42+
putStrLn $ "parent data still: " ++ (show str2)
43+
44+
conditionSignal cond
45+
conditionWait cond mtx
46+
47+
putStrLn $ "parent exiting"
48+
mutexRelease mtx

tests/chez/chez034/expected

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
1/1: Building ThreadData (ThreadData.idr)
2+
Main> parent data initialized to: 13
3+
parent data now: "hello"
4+
child data: "hello"
5+
child data now: 17
6+
parent data still: "hello"
7+
child exiting
8+
parent exiting
9+
Main> Bye for now!

tests/chez/chez034/input

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:exec main
2+
:q

tests/chez/chez034/run

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
rm -rf build
2+
3+
$1 --no-banner --no-color --console-width 0 ThreadData.idr < input
4+

0 commit comments

Comments
 (0)