Преглед изворни кода

* try to unlock mutex before destroying it

git-svn-id: trunk@1186 -
florian пре 20 година
родитељ
комит
a897adf6cc
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      rtl/unix/cthreads.pp

+ 5 - 0
rtl/unix/cthreads.pp

@@ -340,6 +340,11 @@ Type  PINTRTLEvent = ^TINTRTLEvent;
 
     procedure CDoneCriticalSection(var CS);
       begin
+         { unlock as long as unlocking works to unlock it if it is recursive
+           some Delphi code might call this function with a locked mutex      }
+         while pthread_mutex_unlock(@CS)=0 do
+           ;
+
          if pthread_mutex_destroy(@CS) <> 0 then
            runerror(6);
       end;