Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How often is SYS(2015) changed?
Message
 
 
À
02/09/2011 11:06:13
Joel Leach
Memorial Business Systems, Inc.
Tennessie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01521892
Message ID:
01528583
Vues:
48
>I was quite surprised when I ran across this problem in ParallelFox creating temporary files to return to the main process. I wrapped the code in a critical section to avoid filename collisions, but I like your solution better. Thanks!
>

Thanks again.

>>>SYS(2015) is guaranteed to give unique results, and so far I haven't had any problems with it.
>>
>>Not quite.
>>
>>It's guaranteed to give unique results only in a single process.
>>
>>If you have two or more instances running side by side it's quite possible to get duplicate values for SYS(2015). Common problem in Web apps like Web Connection or even multi-threaded DLLs running in IIS in seperate apartments.
>>
>>For this reason it's a good idea to add a Process or Thread Id to SYS(2015):
>>
>>
>>lcId = SYS(2015)+TRANS(Application.ThreadId)
>>
>>
>>Unfortunately this also changes the size of the id and because the value isn't a fixed length it's harder to optmize the id. ThreadIds can be up to 5 digits wide.
>>
>>+++ Rick ---
>>
>>>
>>>>Hi,
>>>>
>>>>I have a routine where the application gets (via SQL select) records into one cursor from one table, then into another cursor from another table, and then again into the 3rd one. For each cursor I use value of SYS(2015). Since the SQL Select time from one cursor to another may take a second or two or could be less than a second. Can I rely that each value of SYS(2015) is unique if it is called within less than a second?
>>>>
>>>>UPDATE: I did a test of running from one .prg SYS(2015) one after another (obviously with less than a second between each) and all names appear to be unique.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform