Hi all,
I have a C# client and a C background process mofifying a shared file.
How does file synchronization work on WM5? What APIs do I use in C# and
which libraries for C? Or do the file IO functions automatically handle
concurrent access with appropriate locks?

Thanks,
Mike

Re: FIle Synchronization by Yaroslav

Yaroslav
Thu Aug 17 03:49:16 CDT 2006

ActiveSync uses Files API to access files that should be synchoronized.
Synchronization is handled by the File API using sharing modes. Most likely
you cannot have write access and synchronize the file at the same time.

--
Yaroslav Goncharov
Spb Software House, http://spbsoftwarehouse.com
Pocket PC Developer Network, http://pocketpcdn.com


"MobileDevlpr" <MobileDevlpr@discussions.microsoft.com> wrote in message
news:2F8ACA98-7D56-4059-94B4-D00F954F6A53@microsoft.com...
> Hi all,
> I have a C# client and a C background process mofifying a shared file.
> How does file synchronization work on WM5? What APIs do I use in C# and
> which libraries for C? Or do the file IO functions automatically handle
> concurrent access with appropriate locks?
>
> Thanks,
> Mike



Re: FIle Synchronization by MobileDevlpr

MobileDevlpr
Thu Aug 17 19:29:01 CDT 2006

Thanks for hte post, but that didn't answer my question. I am not using
ActiveSynch. I have a C++ background process running on the device. At the
same time, I have a C# application running on the device. Both the
background proccess and the application modify the same file. How do the
windows mobile C/C++ libraries support file locking mechanisms so that there
are no race conditions when writing to the file? Also, what .NET libraries
are used for file locking? Is fprintf guaranteed to wait for another process
to finish writing to the file handle before writing? Or is there some
locking mechanism I need to programatically use?

Thanks,
Mike

"Yaroslav Goncharov" wrote:

> ActiveSync uses Files API to access files that should be synchoronized.
> Synchronization is handled by the File API using sharing modes. Most likely
> you cannot have write access and synchronize the file at the same time.
>
> --
> Yaroslav Goncharov
> Spb Software House, http://spbsoftwarehouse.com
> Pocket PC Developer Network, http://pocketpcdn.com
>
>
> "MobileDevlpr" <MobileDevlpr@discussions.microsoft.com> wrote in message
> news:2F8ACA98-7D56-4059-94B4-D00F954F6A53@microsoft.com...
> > Hi all,
> > I have a C# client and a C background process mofifying a shared file.
> > How does file synchronization work on WM5? What APIs do I use in C# and
> > which libraries for C? Or do the file IO functions automatically handle
> > concurrent access with appropriate locks?
> >
> > Thanks,
> > Mike
>
>
>

Re: FIle Synchronization by Yaroslav

Yaroslav
Tue Aug 22 04:00:49 CDT 2006

Synchronization happends when you open the file. The OS handles locking.

For example, if one process opens a file without FILE_SHARE_WRITE in the
shared mode flags, another process will fail to open the file for writing.
If two threads open the file for writing with FILE_SHARE_WRITE and don't use
any synchronization mechanisms you can expect to see some conflicts in the
file.

--
Yaroslav Goncharov
Spb Software House, http://spbsoftwarehouse.com
Pocket PC Developer Network, http://pocketpcdn.com


"MobileDevlpr" <MobileDevlpr@discussions.microsoft.com> wrote in message
news:611628A3-0F18-4C9D-AB25-C8D64A1481E9@microsoft.com...
> Thanks for hte post, but that didn't answer my question. I am not using
> ActiveSynch. I have a C++ background process running on the device. At
> the
> same time, I have a C# application running on the device. Both the
> background proccess and the application modify the same file. How do the
> windows mobile C/C++ libraries support file locking mechanisms so that
> there
> are no race conditions when writing to the file? Also, what .NET
> libraries
> are used for file locking? Is fprintf guaranteed to wait for another
> process
> to finish writing to the file handle before writing? Or is there some
> locking mechanism I need to programatically use?
>
> Thanks,
> Mike
>
> "Yaroslav Goncharov" wrote:
>
>> ActiveSync uses Files API to access files that should be synchoronized.
>> Synchronization is handled by the File API using sharing modes. Most
>> likely
>> you cannot have write access and synchronize the file at the same time.
>>
>> --
>> Yaroslav Goncharov
>> Spb Software House, http://spbsoftwarehouse.com
>> Pocket PC Developer Network, http://pocketpcdn.com
>>
>>
>> "MobileDevlpr" <MobileDevlpr@discussions.microsoft.com> wrote in message
>> news:2F8ACA98-7D56-4059-94B4-D00F954F6A53@microsoft.com...
>> > Hi all,
>> > I have a C# client and a C background process mofifying a shared
>> > file.
>> > How does file synchronization work on WM5? What APIs do I use in C#
>> > and
>> > which libraries for C? Or do the file IO functions automatically handle
>> > concurrent access with appropriate locks?
>> >
>> > Thanks,
>> > Mike
>>
>>
>>