By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,905 Members | 1,665 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,905 IT Pros & Developers. It's quick & easy.

Is this a read/write race condition?

P: n/a
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.

Jul 26 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a

<an***********@yahoo.comwrote in message
news:11**********************@l70g2000hse.googlegr 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

Jul 26 '07 #2

P: n/a
On Jul 26, 1:19 pm, "Lloyd Sheen" <a...@b.cwrote:
<antonyliu2...@yahoo.comwrote in message

news:11**********************@l70g2000hse.googlegr 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.

Jul 26 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.