main logo
Subject: Re: Thread safety in Valentina
Author: Steve Baxter
Posted: 2001/05/30 06:03:11
 
View Entire Thread
New Search


> Hi Steve,
>
>> Is the Valentina file architecture thread safe? I am thinking of using a
>> pre-emptive Windows thread to write my BLOB data into the database and
>> possibly to update other records as well. This would all be done within
>> cursors.
>>
>> Does the database properly block reads and writes to a record that is being
>> written to or read from by a different thread?
>
> I don't think so.
>
> on windows I have "implement" inside of VSDK cooperative multi-tasking using
> one global semaphore.
>
> This means that you can have 10 own threads in your app, but access to
> database will be semaphored.
> I am going change this soon.
>
> So you want do LONG write into BLOB and in the same time work with other
> records (of other tables), yes? Looks as feature of Server :-)

Yes that's what I want to do. The blob write might be 100-200MB, doing it
asynchronously will enable the user to continue working while it saves
changes in the background.

Actually, as long as the database is semaphored, this might work OK. My app
caches quite a lot of the data from the database - in the worst case the
user would have to wait on a database read while the write thread was
completing the current write, but the caches minimise reads in most
circumstances. I can also write the BLOB a bit at a time (say 256K) which
will give blocked threads a chance to access the database quite often.

What would be really cool would be for Valentina to do async writes - then I
can write my BLOB into Valentina's cache and the DB would write out the
cache asynchronously. Might be a little risky though...

Cheers,

Steve.


-------------------------------------------------------------
The Valentina mailing list is brought to you by MacServe.net
For info on lists services, see http://www.macserve.net/lists.html
 
©2001 Steve Baxter
<-- Prior Message New Search Next Message -->