views:

34

answers:

1

According to the MSDN documentation, transactional NTFS doesn't seem to allow one to block on opening a file for write - instead the open operation fails with ERROR_SHARING_VIOLATION. I'd like to block on writes instead - how can I do this?

Ideally I'd like the following properties for the solution:

  1. Works over a network share (so no local named mutex handles)
  2. Auto-releases if the owning process dies
  3. Doesn't require a separate file (named streams are OK)
  4. Allows the locking wait to have a timeout (or be cancellable from another thread or APC)

Does anyone have some experience with a locking method that works with transactional NTFS with these properties?

+2  A: 

I'm not sure I understand exactly what you're asking. TXF doesn't work across SMB shares.

My knee-jerk suggestion would be that if you are using files for this before using TXF, you could continue to use a file for this in non-transacted mode...

FYI, the reason TXF fails these transactional lock conflicts is to help applications avoid deadlocks.

jrtipton