Comments (6)
There is super cheap book about it :
http://www.thedelphigeek.com/2012/06/parallel-programming-with.html
-Tee-
On Tue, Mar 15, 2016 at 3:28 AM, Leonardo Herrera [email protected]
wrote:
Could somebody write a simple tutorial on how to properly execute a task
in the background, without blocking the UI? I'm not talking about parallel
executions, but how to have a procedure to be executed (and being able to
get canceled) in its own thread just for the purpose of not blocking
(completely) the UI.Some messaging is good, but I don't want to get bogged down with the
details. The current examples are either "hello world" or some
incomprehensible, complex thing with many blocking collections, with no
example in between.I'm struggling, badly, with this. Things get either executed many times
(even if I put "NumTasks(1)") or the program get frozen.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#67
from omnithreadlibrary.
Not a real answer!
Anyways, I'm writing a small tutorial on how to avoid freezing your UI using OmnithreadLibrary.
Usually, you get people asking "how can I make this portion of my code run so that the UI keeps being responsive?". The natural answer is "run threads," but threads are complicated beasts to tame when your code is highly coupled.
My own adventure ended happily, but I'm sure it's not completely safe. A nice side effect of trying to parallelize some big chunk of code is that you start seeing your past mistakes. This is huge to me.
Anyways, I even reinstalled some blogging software for this. I'll try not to get sidetracked.
from omnithreadlibrary.
There's a TON of examples in the book, in examples that come wiith the OTL and on my blog.
See here for an index: http://www.omnithreadlibrary.com/tutorials.htm
from omnithreadlibrary.
Primoz,
Yes, there are tons of examples, but that's also part of the issue.
I'm not complying that the work done by you is by any means bad. But it's highly technical, and why wouldn't it be? It is, after all, a very difficult field.
I have had OTL installed for years. I knew it was something else, and way better than trying to use TThread by myself. I've been subscribed to your blog for a long time, followed it thru changed (I remember you had a different blog and homepage), got the SVN distribution, you get the point.
But, let me tell you, Average Joe is not passing your first and second example. I know, because I'm Average Joe, and it took me years and many attemps before really using this in my project.
Anyways, I finally manage to have something somewhat functional. But this documentation problem is a real one, and dismissing it by waving your hand and saying "there is plenty of documentation" is not doing this project any favor. The examples are, in many cases, too abstract to grasp.
And, you know what? After I stumbled for days and got to my final solution, it was so simple! But arriving to it took me long enough.
I'll try to put my money where my mouth it. I'll be writing something for the really uninitiated and let you know.
from omnithreadlibrary.
Actually, I don't want Joe, Average to use OTL. Multithreading is a complex topic and making it simple for everybody just helps everybody to shoot itself it its collective foot. So I want an average user to do a lot of research in advance and to better understand how hard multithreading is before starting using it.
from omnithreadlibrary.
Fair enough. But parallel processing is not always what people needs, sometimes they just need to launch a single task in a different thread and be able to get progress reports and the ability to cancel it. I think that's the most usual use case for threads, at least in Delphi, and a good detailed tutorial on how to accomplish that may be a good thing. Anyways, I'm already working on that. I'll be asking more questions surely.
from omnithreadlibrary.
Related Issues (20)
- Error 1400 HOT 1
- Alexandria HOT 1
- Designtime Release Config incorrect LIB suffix HOT 1
- ForEach not working for objects?
- Madexcept and OTL HOT 2
- Compilation of Release 3.07.9 fails with D2010 HOT 1
- Parallel.For() does not support Int64 (but Delphi's TParallel.For() does)
- Installation on Delphi 11 (GetIt and GroupProj) HOT 2
- PostMessage related Quota error during peak machine latencies
- Bad address when casting FWaitHandle object to TWaiter
- Parallel.ForEach<> inside Parallel.Future<> seems to leak threads HOT 1
- Parallel.ForEach going CRAZY on memory HOT 11
- Dont Install on Alexandria
- Add Delphi 12 support
- Release 3.07.10 does not compile on Delphi older than 10.3 Rio HOT 1
- 3.07.10 please fix hints
- Invalid Delphinus.install.json file
- Out of memory
- Enhancement : Enqueue a message with priority in the TOmniMessageQueue
- Memory Leak When Terminate(0) a Runing Thread
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from omnithreadlibrary.