Topic Options
#1426 - 04/14/08 04:14 AM Locking
SDallas Offline
Junior Member

Registered: 09/04/07
Posts: 7
Loc: Nashville, TN
I have a question about locking a critical section in WinCron.NET. I have a script that reads a list of files from a database table that need to be uploaded to a remote server. The script then begins uploading the files, removing each one from the table upon a successful upload.

I want to schedule the script to run every minute, but I am worried about what might go wrong if a new instance starts while the previous one is still working on its list.

Any advice on this issue? Is there a way to have a script check to see if an instance is already running? Or to lock an object across seperate instances?

Thanks,
Scott

Top
#1427 - 04/14/08 07:58 AM Re: Locking [Re: SDallas]
Luke Tomasello Administrator Online   content
Member

Registered: 09/17/00
Posts: 739
Loc: San Jose, CA., USA
So you’re worried that if while the job is running, the timer will fire to start the job again and you will have two instances accessing the same data. Correct?

No worries. Even though the jobs are scheduled at the same time, the jobs are placed into a queue before they are executed. The system then plucks off the next job from the queue and runs it – waiting until it finished before plucking the next job off the queue.

So you’re safe from WinCron .NET reentering and clobbering your work.
_________________________
Regards,
Luke Tomasello

Top
#1428 - 04/14/08 08:36 AM Re: Locking [Re: Luke Tomasello]
SDallas Offline
Junior Member

Registered: 09/04/07
Posts: 7
Loc: Nashville, TN
That's great news, Luke. One less thing to worry about \:\) Thanks.

Top


Moderator:  Luke Tomasello