Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


October 22, 2001

VBScripting Solutions: Emulating Windows Synchronization Objects


RSS
View this exclusive article with VIP access -- click here to join |
See More Active Server Pages (ASP) Articles Here | Reprints | Or sign up for our VIP Monthly Pass!
Emulating Windows Synchronization Objects

Recently, a client called to describe a specific problem, the general aspects of which are relevant to all script and Windows Script Host (WSH) developers. The problem per se—ensuring synchronization between multiple tasks—wasn't particularly difficult, but the range of tools I needed to use to solve it made the process difficult.

Synchronizing a few tasks in a Win32 application, even in a Microsoft Visual Basic (VB) application, is a matter of calling a couple of API functions: one for creating an appropriate event object and one for putting the calling thread on standby until the OS wakes it up when the event is signaled. So, if you can use Visual C++ (VC++) or VB, the process is easy. However, if—as in this case—the surrounding environment is WSH and VBScript is the language of choice, you must resort to emulation and a bit of creativity.

The Synchronization Problem
My client described the problem thusly: One WSH script has to spawn a few other scripts that use existing executables. The main script has to stop and wait for all the spawned processes to terminate. (The stop-and-wait action is called a blocking wait.) If an error occurs in any child process, the whole operation must be considered canceled, and ideally the overall outcome is as if nothing ever happened. . . .

Top Viewed ArticlesView all articles
No Jobs, No Excitement at Apple's Last Macworld Keynote

Apple CEO Steve Jobs made the right move in skipping out on his company's last appearance at Macworld: In a Tuesday keynote address at the conference, Apple had no interesting new products to sell, opting instead to spend mind-numbing amounts of time on ...

Where is Microsoft NetMeeting in Windows XP?

...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...


Related Articles How to Multi-Thread VBScript Scripts

Related Events Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2009 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing