• R/O
  • SSH

kink: Commit

Kink runtime


Commit MetaInfo

Revisione9c88cee01070d340069b7e42371b667369bdb64 (tree)
Time2020-08-02 09:34:08
Authormiyakawataku
Commitermiyakawataku

Log Message

fix doc of THREAD mod

Change Summary

Incremental Difference

diff -r 1cf1a326d17b -r e9c88cee0107 src/main/resources/kink-mods/kink/thread/THREAD.kn
--- a/src/main/resources/kink-mods/kink/thread/THREAD.kn Fri Jul 31 23:44:58 2020 +0900
+++ b/src/main/resources/kink-mods/kink/thread/THREAD.kn Sun Aug 02 09:34:08 2020 +0900
@@ -1,15 +1,5 @@
11 ##
2-# Provides preemptive threads.
3-#
4-# THREAD.spawn starts a new preemptive thread.
5-#
6-# Living threads do not prevent the process from exiting,
7-# thus they act like Java's daemon threads.
8-#
9-# When you spawn a thread, it is automatically detatched from the spawning thread,
10-# thus there is no need and/or no way to join the thread.
11-# If you want to block until another thread complete its work,
12-# use a chan.
2+# Provides access to preemptive threads.
133
144 :JAVA.require_from('kink/javahost/')
155 :JAVA_PROXY.require_from('kink/javahost/')
@@ -26,8 +16,21 @@
2616
2717 ## THREAD.spawn($thunk)
2818 #
29-# Spawns a preemptive thread, and runs $thunk in the thread.
19+# `spawn` starts a new preemptive thread, and runs $thunk in the thread.
20+#
21+# Precondition:
22+#
23+# • $thunk must be a fun which takes no arg
24+#
3025 # This fun returns nada.
26+#
27+# Living threads do not prevent the process from exiting,
28+# thus they act like Java's daemon threads.
29+#
30+# When you spawn a thread, it is automatically detatched from the spawning thread,
31+# thus there is no need to join the thread.
32+# If you want to block until another thread completes its work,
33+# use a concurrency primitive such as MUTEX.
3134 :spawn <- {(:thunk)
3235 :Thread_name = _make_thread_name
3336 :R = JAVA_PROXY.new(Class_loader [Runnable_class]){(:Method :Args)
@@ -75,9 +78,9 @@
7578
7679 ## THREAD.sleep(Seconds)
7780 #
78-# THREAD.sleep causes the current thread to sleep for the specified Seconds.
81+# `sleep` causes the current thread to sleep for the specified Seconds.
7982 #
80-# Seconds must be a non-negative num of an arbitrary precision.
83+# `Seconds` must be a non-negative num of arbitrary precision.
8184 # The maximum precision effective in the result depends on the runtime system.
8285 # For example, in a Kink runtime system on the JVM,
8386 # the two invocations of STOPWATCH.start in the following program are equivalent.
Show on old repository browser