Locking question

F. Kneubuehl f.kneubuehl at ysd.ch
Sun Dec 12 10:43:38 CST 2010


Hi

I need to solve a simple scenario (a mail slot system):

 

Client A:

  Must  read a textbuffer from a row and set this to NULL

 

Other clients:

  Should wait for Client A until finished with these 2 steps, then write
data to the same textbuffer

 

My solution:

  Client A:

  Cursor = SELECT textbuffer FROM myTable with a ServerSideCursor an
ReadWriteLock

  UPDATE myTable SET textbuffer=NULL

  Cursor = Nothing

 

  Other Clients:

  DO

      Cursor = SELECT textbuffer FROM myTable with a ServerSideCursor an
ReadWriteLock

  LOOP UNTIL DBError=0

  UPDATE myTable SET textbuffer=AnyData

  Cursor = Nothing

 

This approach seems to work, but because the process runs on a random
fashion with a 200ms timer I am not sure if this is the right and stable
way. Any client can act as 'Client A' and 'Other Clients'.

 

Any comment would be helpful!

 

Fabian Kneubuehl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macserve.net/pipermail/valentina/attachments/20101212/f1ddda98/attachment.htm>


More information about the Valentina mailing list