浏览代码

+ tthread.start method, simply calls tthread.resume for now (mantis #16326)

git-svn-id: trunk@15165 -
Jonas Maebe 15 年之前
父节点
当前提交
c67712f81f
共有 4 个文件被更改,包括 38 次插入0 次删除
  1. 1 0
      .gitattributes
  2. 8 0
      rtl/objpas/classes/classes.inc
  3. 1 0
      rtl/objpas/classes/classesh.inc
  4. 28 0
      tests/webtbs/tw16326.pp

+ 1 - 0
.gitattributes

@@ -10353,6 +10353,7 @@ tests/webtbs/tw1622.pp svneol=native#text/plain
 tests/webtbs/tw16222.pp svneol=native#text/pascal
 tests/webtbs/tw1623.pp svneol=native#text/plain
 tests/webtbs/tw16311.pp svneol=native#text/plain
+tests/webtbs/tw16326.pp svneol=native#text/plain
 tests/webtbs/tw16328.pp svneol=native#text/plain
 tests/webtbs/tw1634.pp svneol=native#text/plain
 tests/webtbs/tw1658.pp svneol=native#text/plain

+ 8 - 0
rtl/objpas/classes/classes.inc

@@ -106,6 +106,14 @@ function ThreadProc(ThreadObjPtr: Pointer): PtrInt;
 { system-dependent code }
 {$i tthread.inc}
 
+procedure TThread.Start;
+begin
+  { suspend/resume are now deprecated in Delphi (they also don't work
+    on most platforms in FPC), so a different method was required
+    to start a thread if it's create with fSuspended=true -> that's
+    what this method is for. }
+  Resume;
+end;
 
 function TThread.GetSuspended: Boolean;
 begin

+ 1 - 0
rtl/objpas/classes/classesh.inc

@@ -1504,6 +1504,7 @@ type
                        const StackSize: SizeUInt = DefaultStackSize);
     destructor Destroy; override;
     procedure AfterConstruction; override;
+    procedure Start;
     procedure Resume;
     procedure Suspend;
     procedure Terminate;

+ 28 - 0
tests/webtbs/tw16326.pp

@@ -0,0 +1,28 @@
+{$mode objfpc}
+{$H+}
+
+uses
+{$ifdef unix}
+  cthreads,
+{$endif}
+  classes
+  ;
+
+type
+  tthread1 = class(tthread)
+  public
+    procedure execute; override;
+  end;
+
+procedure tthread1.execute;
+begin
+end;
+
+var
+  thread1: tthread1;
+begin
+  thread1 := tthread1.create(true);
+  thread1.start;
+  thread1.waitfor;
+  thread1.free;
+end.