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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top