LB Booster
« Help With Simultaneous Operations »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:45am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Help With Simultaneous Operations  (Read 233 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Help With Simultaneous Operations
« Thread started on: Jan 29th, 2016, 4:35pm »

I am temporarily breaking my self-imposed exile because of extreme frustration at the poor quality of some replies I see at the LB Community Forum. There's currently a thread there about how one might do something else while an FTP download is taking place.

The answer given was that this isn't possible in native LB code because it doesn't support multithreading. But this is highly misleading, if not plain wrong. The reason you can't straightforwardly do it isn't because neither LB nor LBB support multithreading but because the URLDownloadToFile API is blocking, that is it doesn't return to the caller until the entire file has been downloaded.

In fact it is relatively straightforward to replace the single call to that API with multiple calls to the InternetReadFile API. That allows you to download the file in chunks of a size that you specify; it might be as little as 1 Kbyte at a time. Now, you can easily 'do something else' while downloading the file, because control is returned to your LB program after each chunk.

You are not actually performing 'simultaneous operations', that would indeed involve not only multiple threads but multiple CPUs, but as far as the user is concerned the effect is exactly the same.

Rant over. I will go and hide in a corner again.

Richard.
User IP Logged

net2014
New Member
Image


member is offline

Avatar




PM


Posts: 37
xx Re: Help With Simultaneous Operations
« Reply #1 on: Jan 29th, 2016, 7:51pm »

Please keep peeping out of that corner Richard wink

Thanks, I now understand the term 'blocking'
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls