Edwin Yip 154 Posted February 23, 2019 (edited) I discovered SimpleQueue.pas from CommonX recently, which allows you to push a bunch of procedures or closures (anonymous methods) to the queue and they'll be executed in a background thread one by one. As you can imagine, this can have a lot of uses on the server side. The concept is very similar to Google cloud's Task Queue, which I read sometime ago. I especially like that SimpleQueue.pas allows you to add code for execution to the queue via anon. methods, it must be very handy. The issue I'm with it is that CommonX doesn't my XE4 well, and I can understand that and I'm not complaining, but just ask if there are other options of the same kind of 'code execution queue' (not data queues, that we have a bunch of excellent implementations) that I can check out? PS: I know I can change the code, but since CommonX (a lot of useful things in it) has 900+ .pas files and I'm not sure how heavily SimpleQueue.pas depends on the other units, so that'll be the last option, especially I don't need to use it immediately :) Thanks. Edited February 23, 2019 by edwinyzh Share this post Link to post
Primož Gabrijelčič 223 Posted February 23, 2019 OmniThreadLibrary has many similar constructs. The closes of them is possibly a Pipeline, or a BackgroundWorker, or an Async, depending of what exactly do you want to do with the code. There's a separate subforum for OmniThreadLibrary here: https://en.delphipraxis.net/forum/32-omnithreadlibrary/ Share this post Link to post
Edwin Yip 154 Posted February 24, 2019 Thanks PG, BackgroundWorker sounds exactly the solution. On the other hand, it just occurred to me that, I can just create a data queue and a long-living thread to accomplish the task :) 1 Share this post Link to post