Re: multi threading in C#

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:op.tstjksuj8jd0ej@xxxxxxxxxxxxxxxxxxxxxxx

Uh. Maybe I'm missing something, but...if you lock on a reference that
only you have access to, but the object you're protecting is visible to
others, doesn't that also mean that an alternate way for someone else to
screw things up is by accessing the object *without* locking it?

This would be possible in both cases. Making the lock object publicly
accessible doesn't force callers to lock.
The trick is, to implement the class in such a way, that it can be used
safely without locking in any multithreaded implementation.

Christof


.



Relevant Pages

  • Re: using clustered index to optimize inserts ...
    ... I will try to explain locking in terms of Sybase docs... ... Allpages Locking: Allpages locking locks both data pages and index ... the data page is locked with an exclusive lock. ... Clustered Index: The datarows will be arranged as per the clustered ...
    (comp.databases.sybase)
  • Re: CSingleLock - known behaviour?
    ... It is better to design code that doesn't require locking. ... If you don't need the resource, don't lock it. ... magnitude less efficient, than locking once. ...
    (microsoft.public.vc.mfc)
  • Re: Strange multi-user timing phenomenon
    ... table record with pessimistic locking and both edit the same record. ... the recordset will be sufficient to lock out other users. ... update the recordset (if you had to edit data) and then close it. ...
    (microsoft.public.access.formscoding)
  • Re: Threads - why isnt a whole object locked when ...?
    ... All of your questions are answerable by pointing out that you have an incorrect mental model of what it means to "lock" something. ... That is, while it's entirely sensible to people who are familiar with standard thread synchronization techniques, in reality it's not actually locking anything. ... Instead, it's using the reference as a sort of traffic signal for other threads, which are cooperating, to respect. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Strange multi-user timing phenomenon
    ... I tried your locking method using a perssimistic recordset and it appears to ... user places his lock and grabs the same record. ... I would try opening a fixed single-row recordset with pessimistic locking, ...
    (microsoft.public.access.formscoding)