thread savely accessing a table/dataset

  • Thread starter Thread starter Anton Sommer
  • Start date Start date
A

Anton Sommer

Hello folks,

I have in central object a dataset and there is only one thread writing to
it and it is therefore using synclock when writing. This should be
multithread save enough (if not please tell me so). But know I have multiple
threads that read from this table, what precautions should be taken, shall I
use synclock as well for reading? Or can it just be used without
precautions? I mean even calling the select method or simply using findby
can this be done without precautions?


thank you

Anton
 
You need to lock if you write, you should be safe otherwise. That is, if you
lock before you write, then reading operations will cause a thread block if
a write barrier exists on the object. Once the lock is released, the read
will take place.
 
Hello Alvin thank you for replying,


Alvin Bruney said:
You need to lock if you write, you should be safe otherwise. That is, if you
lock before you write, then reading operations will cause a thread block if
a write barrier exists on the object. Once the lock is released, the read
will take place.

Do think that I will be save as well when call a method of the table i.e.
select or findby

Thank you


Anton
 
Back
Top