Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-02-2010, 11:40 AM
Too_Tall_Crown_Victoria Too_Tall_Crown_Victoria is online now
Registered User
 
Join Date: 01-15-2003
Posts: 44
Global Macros that refresh

We have a need to create a global counter for how many times a task runs. We have approximately 10 build scripts that can each run around the same time. My first iteration was to create a global subroutine that will increment a global macro. However, I discovered that the global macros are not being updated as each script runs. It seems that the global macro states are read when the script starts and remains with the script. So if one script updates a macro, that update is not seen by the other scripts running.

Is there a way to make this happen so that these macros are up to date so I can use these global macros as counters for all scripts running? If this will not work, do you have another suggestion as to how to make this work and avoid collisions?

Thanks
Reply With Quote
  #2  
Old 09-02-2010, 01:06 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Global macro changes made by other instances of Visual Build are reloaded before each step.
http://www.kinook.com/VisBuildPro/Ma...obalmacros.htm

However, this is not an atomic/interlocked update, so near-simultaneous changes made by one instance could overwrite those of another (both could read value x, increment to x+1 and save instead of ending up at x+2), and file in use errors could occur with several simultaneous instances all updating global macros at once.

To implement a true atomic update, one way might be to call a program that opens a common file for exclusive access (waiting+retrying if already in use), then reads+updates the value in the file, and closes the file and returns the value. I don't believe this can be done with the scripting FileSystemObject and may require something like C# or C.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 03:43 PM.


Copyright © 1999-2023 Kinook Software, Inc.