Re: A new Critical Section for high contention situations




"Kürsat" <xx@xxxxxx> wrote in message
news:O3NzUVrtIHA.3716@xxxxxxxxxxxxxxxxxxxxxxx

Oh my God! I am so sorry, using "if" in place of "while" makes
almost every code illogical. I am sorry again, below is updated code:

Your code is still missing an important feature that every synchronization
object MUST support. If a thread calls enter() and then calls enter() again
before calling leave() (such as from nested code making local calls to
enter/leave()), enter() MUST EXIT WITHOUT BLOCKING, and the lock must NOT be
released until leave() is called TWICE. Otherwise a deadlock occurs. Your
code is not handling those possibilities yet. The first time enter() is
called, your lock is NOT_OWNED, so it gets updated to OWNED and enter()
exits. However, the next time enter() is called on the same thread, the
lock may still be OWNED, and you would then enter an endless loop since the
owning thread can never call leave(). The only possibility would be if
another thread called leave(), but that would be impossible since enter()
could never exit in those threads, either.


Gambit


.



Relevant Pages

  • Re: Syntax error in Form
    ... Private Sub cmdAdd_Click ... Exit Sub ... "RuralGuy" wrote: ... >> gets added(only for the first time the form is opened). ...
    (microsoft.public.access.formscoding)
  • Re: Requiring a password?
    ... Teach your users to lock ... >> their workstations if they don't want their mail read. ... >>> application running on the desktop then only the Outlook app will ... >>> exit and leave the session connected to the mailbox. ...
    (microsoft.public.exchange.admin)
  • Re: c# Thread problem
    ... This is my first time to use thread.. ... You also shouldn't manually be calling Monitor.Enter/Exit - use lock ... deadlock position is lock (queueLock) at addNewMsg function... ... GUIMsg gMsg; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Ensuring a nice clean application quit experience
    ... My preferred design is to have a table with a single row that contains ... the network name of the person currently connected to the database. ... there is no 100% reliable way to delete the record on exit. ... The record lock should release when Access shuts down. ...
    (comp.databases.ms-access)
  • Re: A new Critical Section for high contention situations
    ... protect a queue which is pounded by a number of threads. ... enqueus and dequeues I used CRITICAL_SECTION but because of high contention ... to enter/leave), enterMUST EXIT WITHOUT BLOCKING, and the lock must ... impossible since entercould never exit in those threads, ...
    (microsoft.public.win32.programmer.kernel)