Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Is this a read/write race condition?

Reply
Thread Tools

Is this a read/write race condition?

 
 
antonyliu2002@yahoo.com
Guest
Posts: n/a
 
      07-26-2007
I do not quite understand the race condition.

As I posted a couple of days ago, I create a PDF on the fly in my web
application at regular intervals. Users will be able to download the
PDF file.

Suppose, at the time when my application is in the process of
generating the PDF file (which takes around 2.5 minutes), a user tries
to download it, will this be a problem?

I checked the Lock method of FileStream. The description of this
method says:

Prevents other processes from changing the FileStream while permitting
read access.

>From the description, read access is permitted even if the stream is

locked. So, it looks like the creation of the PDF file and the
downloading of this file can happen at the same time without a
problem, right?

Thanks.

 
Reply With Quote
 
 
 
 
Lloyd Sheen
Guest
Posts: n/a
 
      07-26-2007

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
>I do not quite understand the race condition.
>
> As I posted a couple of days ago, I create a PDF on the fly in my web
> application at regular intervals. Users will be able to download the
> PDF file.
>
> Suppose, at the time when my application is in the process of
> generating the PDF file (which takes around 2.5 minutes), a user tries
> to download it, will this be a problem?
>
> I checked the Lock method of FileStream. The description of this
> method says:
>
> Prevents other processes from changing the FileStream while permitting
> read access.
>
>>From the description, read access is permitted even if the stream is

> locked. So, it looks like the creation of the PDF file and the
> downloading of this file can happen at the same time without a
> problem, right?
>
> Thanks.
>


Perhaps you could do one of the following:

1. Create the PDF with a different name than the name which users will
download. Once the PDF is created then delete the old one and change the
name of the new one to the download name.

2. Disable the mechanism (button ??) to download the file while a new on is
being created.

Hope this helps,

Lloyd Sheen

 
Reply With Quote
 
 
 
 
antonyliu2002@yahoo.com
Guest
Posts: n/a
 
      07-26-2007
On Jul 26, 1:19 pm, "Lloyd Sheen" <(E-Mail Removed)> wrote:
> <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) oups.com...
>
>
>
> >I do not quite understand the race condition.

>
> > As I posted a couple of days ago, I create a PDF on the fly in my web
> > application at regular intervals. Users will be able to download the
> > PDF file.

>
> > Suppose, at the time when my application is in the process of
> > generating the PDF file (which takes around 2.5 minutes), a user tries
> > to download it, will this be a problem?

>
> > I checked the Lock method of FileStream. The description of this
> > method says:

>
> > Prevents other processes from changing the FileStream while permitting
> > read access.

>
> >>From the description, read access is permitted even if the stream is

> > locked. So, it looks like the creation of the PDF file and the
> > downloading of this file can happen at the same time without a
> > problem, right?

>
> > Thanks.

>
> Perhaps you could do one of the following:
>
> 1. Create the PDF with a different name than the name which users will
> download. Once the PDF is created then delete the old one and change the
> name of the new one to the download name.
>
> 2. Disable the mechanism (button ??) to download the file while a new on is
> being created.
>
> Hope this helps,
>
> Lloyd Sheen


Hi, Lloyd,

Thanks. your idea 1 is absolutely a good solution, since changing the
file name is only a flash of second in an application. That will
certainly reduce the probability of race condition otherwise imposed
in a 2.5-minute duration when the PDF file is being created.

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VHDL - processes, race conditions, & Verilog Taras_96 VHDL 7 04-05-2005 01:01 AM
race conditions/pulse width The Weiss Family VHDL 6 10-19-2004 02:47 PM
OT: The race so far Neil MCSE 33 07-02-2004 07:45 PM
OT: The race so far today... =?iso-8859-1?Q?Frisbee=AE?= MCSE 248 07-02-2004 06:59 PM
Mega Pixel race is like the Mhz Race Hugo Drax Digital Photography 7 01-12-2004 11:07 AM



Advertisments