Article Preview
Buy Now
COLUMN
Threads
Threads aren't so scary
Issue: 17.1 (January/February 2019)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 16,931
Starting Page Number: 75
Article Number: 17107
Related Link(s): None
Excerpt of article text...
In the last issue (
xDev 16.6) I answered a reader email about updatingProgressBars
usingthreads
. It occurred to me that I haven't written about threads inBeginner's Corner , so today we'll explore that (hairy) topic.Threads tend to intimidate beginning programmers and thus they avoid them, but I'm here to tell you that your fears are (somewhat) overblown.
Yes, it is true that there are situations where threads can become incredibly complicated (more on that in a moment), but I've been using threads in a basic manner for years without any such trouble. I'll admit right off I'm no thread expert, but I bet you can also use threads in a simple way that will have key benefits for your programs.
What Are Threads?
Just the name,
thread
, sounds a little odd. Then there are associated terms likesemaphore
,mutex
, andCriticalSection
. Worst of all is hearing nightmare stories from experienced developers about problems they're having with threads. You might just decide threads are an advanced feature you should avoid.But threads are important. Normally, Xojo code is executed while the user-interface is frozen. The program can't do anything else until that task it done.
...End of Excerpt. Please purchase the magazine to read the full article.