core-async

Anik Chowhdury 2019-08-09T03:11:38.115700Z

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.

2019-08-09T03:34:29.116700Z

Neither of those is correct

❤️ 1
2019-08-09T03:35:19.118Z

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

2019-08-09T03:36:50.119500Z

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

2019-08-09T03:37:04.119900Z

The result of calling your function

2019-08-09T03:38:37.121200Z

thread is the macro like future

2019-08-09T03:40:21.123600Z

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