Home Trying to understand the asynchrouny with a big amount of different function calls
Reply: 0

Trying to understand the asynchrouny with a big amount of different function calls

user1375
1#
user1375 Published in July 18, 2018, 4:56 am

I've started learing an asynchronous aproach, and encountered a problem, help me with it.

The purpose is: get from somewhere a char data, and after that do something with it(using as text on the button, in my case). The code, that is pinned below is very slow. The most slowiest moment is a data getting: the fact is that the get(int id) function loads data from internet via WinInet(synchronously), sending the Post methods, and returning the answer.

void some_func()
{
for(int i(0);i<10;i++)
   for(int q(0);q<5;q++)
     {
       char data[100];
       strcpy(data, get(i,q)); // i, q - just some identifier data

       button[5*i+(q+1)]=new Button(data);
     }
}

The first question:

How should it be solved(generaly, I mean, if get has nothing to do with the internet, but runs slow)? I have only one, stupid idea: run get in every separate thread. If it's the right way - how should I do that? Cause, it's wrong to, created 50 threads call from each the get function. 50 get functions?

Second Question

How to realize it with WinInet? Have red MSDN, but it too hardly for me, as for newer, maybe you explain it more simlier?

Thanks

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.322502 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO