Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 19th, 2010, 05:56 PM
Registered User
 
Join Date: Jan 2010
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default Question about AcquireWriterLock

Hi all I need your help with understanding this issue.
Chapter 7, class Newsletter (BLL) ,
in function SendNewsletter :
Code:
 Lock.AcquireWriterLock(Timeout.Infinite);
   Newsletter.TotalMails = -1;
   Newsletter.SentMails = 0;
   Newsletter.PercentageCompleted = 0.0;
   Newsletter.IsSending = true;
   Lock.ReleaseWriterLock();
Why there is a lock? this code is not run by the new thread.

thanks
 
Old January 23rd, 2010, 07:20 PM
Registered User
 
Join Date: Jan 2010
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default

And also, as I understand only one thread can be created in the application domain in a same time (only one administrator can send the newsletter in a same time, others must wait).
In this case we need lock only on Newsletter.IsSending because only this static variable is shared.

So why there are also locks on Newsletter.PercentageCompleted if only one and only thread use it?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Disappearing UserName & Question within Customized PasswordRecovery Question Template eddiemcham ASP.NET 3.5 Basics 13 June 13th, 2009 04:23 AM
IF question fizzerchris SQL Language 3 October 17th, 2007 10:41 PM
COM Question... dbrook007 Pro VB 6 1 June 5th, 2006 03:26 PM
COM Question... dbrook007 VB Components 0 May 30th, 2006 07:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.