소스 검색

* throw an error if RTLEventCreate() fails on Unix

git-svn-id: trunk@28964 -
Jonas Maebe 10 년 전
부모
커밋
35a313d98c
1개의 변경된 파일13개의 추가작업 그리고 2개의 파일을 삭제
  1. 13 2
      rtl/unix/cthreads.pp

+ 13 - 2
rtl/unix/cthreads.pp

@@ -874,8 +874,19 @@ var p:pintrtlevent;
 
 begin
   new(p);
-  pthread_cond_init(@p^.condvar, nil);
-  pthread_mutex_init(@p^.mutex, nil);
+  if not assigned(p) then
+    fpc_threaderror;
+  if pthread_cond_init(@p^.condvar, nil)<>0 then
+    begin
+      dispose(p);
+      fpc_threaderror;
+    end;
+  if pthread_mutex_init(@p^.mutex, nil)<>0 then
+    begin
+      pthread_cond_destroy(@p^.condvar);
+      dispose(p);
+      fpc_threaderror;
+    end;
   p^.isset:=false;
   result:=PRTLEVENT(p);
 end;