Fork me on GitHub
Anik Chowhdury03:08:38

I have used future for multhreading in core-async. Here is the screenshot of my code and error message. I got null pointer exception for using future. If i use just

(async/thread-call (process-data-chan))
instead of
(future (async/thread-call (process-data-chan)))
i dont get any null pointer exception. Can anyone explain me and give me solution about this? I am newbie in clojure and specially in multi threading.


Neither of those is correct

❤️ 4

Calling thread or thread-call like that in a future is making a new thread in a new thread


thread-call takes a function and you are passing it nil


The result of calling your function


thread is the macro like future


Replacing future with thread is pointless unless you are using go blocks which need to park in the result, the both just run whatever on a thread pool, no difference except the return value which doseq throws away