Thread synchronization question

  • Thread starter Thread starter Alvin Bruney [MVP]
  • Start date Start date
A

Alvin Bruney [MVP]

What happens in the case where a mutex is used to protect a file on a
windows application, but a unix script running elsewhere attempts to
manipulate that file while the mutex is not signaled? Is synchronization
enforced over these disparate systems? How?
 
Since the UNIX script runs outside your Windows Application's AppDomain, it
won't protect your file.

-Oleg.
 
That is sad. Is there any way to protect the file in my situation?

--
Regards,
Alvin Bruney
Oleg Ogurok said:
Since the UNIX script runs outside your Windows Application's AppDomain,
it won't protect your file.

-Oleg.
 
rather 'ugly' but how about marking the file as read only.

HTH

Ollie Riches



Alvin Bruney said:
That is sad. Is there any way to protect the file in my situation?
 
That's not really going to help, since his program is going to want to
access it. Basically, Alvin is going to have to lock the file exclusively
when he accesses it. When the Unix system tries to access the file, it will
be denied, and that system will have to prepare for that (since it will have
to access the file through Windows anyway, this will work).
 
only a suggestion :)

okay how about renaming the file temporarly?

Ollie

P.S. caspers house doesn't like firefox much......


Nicholas Paldino said:
That's not really going to help, since his program is going to want to
access it. Basically, Alvin is going to have to lock the file exclusively
when he accesses it. When the Unix system tries to access the file, it will
be denied, and that system will have to prepare for that (since it will have
to access the file through Windows anyway, this will work).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Ollie Riches said:
rather 'ugly' but how about marking the file as read only.

HTH

Ollie Riches
 
Alvin:

I think the only way to do this is at the OS level. Open the file for
exclusive access. Windows (the OS) will prevent access to it until the
opening application releases its lock.

John Puopolo
 
Ollie,

That's not going to help either, because the OP wants to synchronize
access to the same file. If both want to write, and he is using a copy,
then the unix process won't be able to see the changes he makes. He has to
exclusively lock the file, or use some sort of transaction coordinator that
works with files, or run a custom solution where the unix process sends
messages to a process on the windows box indicating the operations it wants
to take, and only that process on the windows box can access the file.

As for caspershouse.com, I'm not too big on cross-browser compatability
=) Sorry.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Ollie Riches said:
only a suggestion :)

okay how about renaming the file temporarly?

Ollie

P.S. caspers house doesn't like firefox much......


in
message news:[email protected]...
That's not really going to help, since his program is going to want
to
access it. Basically, Alvin is going to have to lock the file
exclusively
when he accesses it. When the Unix system tries to access the file, it will
be denied, and that system will have to prepare for that (since it will have
to access the file through Windows anyway, this will work).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Ollie Riches said:
rather 'ugly' but how about marking the file as read only.

HTH

Ollie Riches



"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
That is sad. Is there any way to protect the file in my situation?

--
Regards,
Alvin Bruney
message

Since the UNIX script runs outside your Windows Application's
AppDomain,
it won't protect your file.

-Oleg.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
message
What happens in the case where a mutex is used to protect a file on a
windows application, but a unix script running elsewhere attempts
to
manipulate that file while the mutex is not signaled? Is
synchronization
enforced over these disparate systems? How?
 
I was thinking along the lines that a process would attempt to rename the
file and do what it wants and then rename it back to the original name, if
the other process attempt to access\rename the file whilst the other process
is using the file it would fail and it would have to schedule a retry.....

but as John points out why not just use an exclusive open on the file.

Ollie

Nicholas Paldino said:
Ollie,

That's not going to help either, because the OP wants to synchronize
access to the same file. If both want to write, and he is using a copy,
then the unix process won't be able to see the changes he makes. He has to
exclusively lock the file, or use some sort of transaction coordinator that
works with files, or run a custom solution where the unix process sends
messages to a process on the windows box indicating the operations it wants
to take, and only that process on the windows box can access the file.

As for caspershouse.com, I'm not too big on cross-browser compatability
=) Sorry.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Ollie Riches said:
only a suggestion :)

okay how about renaming the file temporarly?

Ollie

P.S. caspers house doesn't like firefox much......


in
message news:[email protected]...
That's not really going to help, since his program is going to want
to
access it. Basically, Alvin is going to have to lock the file
exclusively
when he accesses it. When the Unix system tries to access the file, it will
be denied, and that system will have to prepare for that (since it will have
to access the file through Windows anyway, this will work).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

rather 'ugly' but how about marking the file as read only.

HTH

Ollie Riches



"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
That is sad. Is there any way to protect the file in my situation?

--
Regards,
Alvin Bruney
message

Since the UNIX script runs outside your Windows Application's
AppDomain,
it won't protect your file.

-Oleg.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
message
What happens in the case where a mutex is used to protect a file
on
a
windows application, but a unix script running elsewhere attempts
to
manipulate that file while the mutex is not signaled? Is
synchronization
enforced over these disparate systems? How?
 
Which is what I pointed out two postings ago =)

Ollie Riches said:
I was thinking along the lines that a process would attempt to rename the
file and do what it wants and then rename it back to the original name, if
the other process attempt to access\rename the file whilst the other
process
is using the file it would fail and it would have to schedule a retry.....

but as John points out why not just use an exclusive open on the file.

Ollie

in
message news:#[email protected]...
Ollie,

That's not going to help either, because the OP wants to synchronize
access to the same file. If both want to write, and he is using a copy,
then the unix process won't be able to see the changes he makes. He has to
exclusively lock the file, or use some sort of transaction coordinator that
works with files, or run a custom solution where the unix process sends
messages to a process on the windows box indicating the operations it wants
to take, and only that process on the windows box can access the file.

As for caspershouse.com, I'm not too big on cross-browser compatability
=) Sorry.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Ollie Riches said:
only a suggestion :)

okay how about renaming the file temporarly?

Ollie

P.S. caspers house doesn't like firefox much......


"Nicholas Paldino [.NET/C# MVP]" <[email protected]>
wrote
in
message That's not really going to help, since his program is going to
want
to
access it. Basically, Alvin is going to have to lock the file
exclusively
when he accesses it. When the Unix system tries to access the file,
it
will
be denied, and that system will have to prepare for that (since it
will
have
to access the file through Windows anyway, this will work).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

rather 'ugly' but how about marking the file as read only.

HTH

Ollie Riches



"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
message
That is sad. Is there any way to protect the file in my situation?

--
Regards,
Alvin Bruney
message

Since the UNIX script runs outside your Windows Application's
AppDomain,
it won't protect your file.

-Oleg.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
message
What happens in the case where a mutex is used to protect a file on
a
windows application, but a unix script running elsewhere
attempts
to
manipulate that file while the mutex is not signaled? Is
synchronization
enforced over these disparate systems? How?
 
okay i give up now :)

Nicholas Paldino said:
Which is what I pointed out two postings ago =)

Ollie Riches said:
I was thinking along the lines that a process would attempt to rename the
file and do what it wants and then rename it back to the original name, if
the other process attempt to access\rename the file whilst the other
process
is using the file it would fail and it would have to schedule a retry.....

but as John points out why not just use an exclusive open on the file.

Ollie

in
message news:#[email protected]...
Ollie,

That's not going to help either, because the OP wants to synchronize
access to the same file. If both want to write, and he is using a copy,
then the unix process won't be able to see the changes he makes. He
has
to
exclusively lock the file, or use some sort of transaction coordinator that
works with files, or run a custom solution where the unix process sends
messages to a process on the windows box indicating the operations it wants
to take, and only that process on the windows box can access the file.

As for caspershouse.com, I'm not too big on cross-browser compatability
=) Sorry.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


only a suggestion :)

okay how about renaming the file temporarly?

Ollie

P.S. caspers house doesn't like firefox much......


"Nicholas Paldino [.NET/C# MVP]" <[email protected]>
wrote
in
message That's not really going to help, since his program is going to
want
to
access it. Basically, Alvin is going to have to lock the file
exclusively
when he accesses it. When the Unix system tries to access the file,
it
will
be denied, and that system will have to prepare for that (since it
will
have
to access the file through Windows anyway, this will work).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

rather 'ugly' but how about marking the file as read only.

HTH

Ollie Riches



"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
message
That is sad. Is there any way to protect the file in my situation?

--
Regards,
Alvin Bruney
message

Since the UNIX script runs outside your Windows Application's
AppDomain,
it won't protect your file.

-Oleg.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
message
What happens in the case where a mutex is used to protect a
file
on
a
windows application, but a unix script running elsewhere
attempts
to
manipulate that file while the mutex is not signaled? Is
synchronization
enforced over these disparate systems? How?
 
Back
Top