Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why Processing Performance is Not Increasing ?
Message
De
15/02/2014 14:49:44
 
 
À
15/02/2014 13:31:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01594373
Message ID:
01594427
Vues:
43
Hmmm.... that's not good. Who maintains Parallel Fox? Perhaps they can add that feature. It would seem to be an important thing to know, perhaps optionally as a lot of times you don't care, cut some times you do care.

The GetCurrentThread() function will retrieve a handle to the current thread, which will most likely be a very large integer, and not the sequential thread number.

One way you can simulate determining which thread you are is to have the spawning parent thread (the one which launches the Parallel Fox worker threads) to, before it launches any of the worker threads, create the CPU count of files like "file1.txt", "file2.txt" ... "file8.txt" for an 8-core with 8-threads. Then, in your startup algorithm of each thread, search sequentially from 1 to 8 trying to gain exclusive access to one of those files by using FOPEN() with read/write setting. Once that file is open, you'll know that's your thread number and you can proceed to lock onto that ps2pdf.dll copy. Keep the fileN.txt file open until your thread terminates, then close it. By iterating from 1 to 8 you should be able to always determine a thread number assignment. And, if you spawn two or more threads per core (not a bad idea on a Core i7 8-core) you can create file1.txt ... file16.txt, and so on.

In the alternative, use a table and sequentially replace a column with whatever value it is plus one, either opening the table exclusively, or using a lock, getting your value, updating the value, then closing the table (if using it exclusively). That way you can guarantee atomic access to the table so that every process will only get its value, and all of them will be 1..8, or 1..16.

Good luck, Harsh. Your programming skills and resourcefulness have really improved over the past many months.


-----
>Sir, there is no function in Parallel Fox to identify the Thread Number. I will try the next option suggested by you also
>I found WINAPI in news2news.com for getting the thread number. I will try both and will seek your help again on the
>issue later.
>
>Here it is
>
>
>DECLARE INTEGER GetCurrentThread;
>    IN kernel32
>
>
>Harsh
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform