Re: Simple gui app with threadpool

2020-06-14 Thread elo
@jackhftang looks promising :) I haven't seen this library before (unfortunately awesome nim is not updated). I'm sure I'll try to use it @aguspiza2 ah, now it's all clear ;) I saw libui, but it looked 'unfriendly' compared to nigui (at least for me) but, of course, i also try. Thanks for expla

Re: Simple gui app with threadpool

2020-06-14 Thread jackhftang
If your threads are long-living and you are okay to talk in json between threads. You can make use of threadproxy library. import strutils import nigui import os import threadproxy proc workerMain(proxy: ThreadProxy) {.thread.} = proxy.onData "task1":

Re: Simple gui app with threadpool

2020-06-14 Thread aguspiza2
If you do ^t just after spawn, you are effectively not using the worker thread as the UI thread is blocked waiting the worker thread to finish. What you should do is to spawn a thread and inside the worker thread notify the UI thread that "t" is ready, so UI thread can then update "textArea". T

Simple gui app with threadpool

2020-06-14 Thread elo
Hi. I'm trying to make a simple gui app that performs functions at the press of a button. Of course, func is called in the main thread, so gui is freezing. I tried use the threadpool module, but I do something wrong. From what I understood, to read the result from thread, I have to use ^, but th