Skip to content

Commit 8453cab

Browse files
committed
readme: add some clarifications regarding return types
1 parent 88da813 commit 8453cab

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ Stacktrace:
2929
@ REPL[3]:1
3030
```
3131

32+
Note regarding the return type of `@spawn`:
33+
* `Threads.@spawn` returns a value of the concrete type `Task`
34+
* In contrast, the return type of `StableTasks.@spawn` may depend on any and all of the following:
35+
* the configuration of type inference in the Julia compiler
36+
* the return type of the input function
37+
* in particular, `typeof(StableTasks.@spawn 3) != typeof(StableTasks.@spawn 3.0)`, because `typeof(3) !== typeof(3.0)`
38+
3239
## `StableTasks.@spawnat`
3340

3441
The package also provides `StableTasks.@spawnat`, which is similar to `StableTasks.@spawn` but creates a *sticky* task (that won't migrate) on a specific thread.
@@ -40,6 +47,8 @@ julia> @inferred fetch(t)
4047
4
4148
```
4249

50+
The note regarding the return type of `@spawn` also applies here.
51+
4352
## `StableTasks.@fetch` and `StableTasks.@fetchfrom`
4453

4554
For convenience, and in analogy to at Distributed.jl, we also provide `@fetch` and `@fetchfrom` macros:

0 commit comments

Comments
 (0)