forked from andremussche/DelphiWebsockets
-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Portable.Threads.pas
43 lines (36 loc) · 1.02 KB
/
Portable.Threads.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
unit Portable.Threads;
interface
uses
{$IF DEFINED(ANDROID)}
FMX.Helpers.Android;
{$ELSE}
System.Classes;
{$ENDIF}
type
{$IF DECLARED(FMX.Helpers.Android.TMethodCallback)}
TMethodCallback = FMX.Helpers.Android.TMethodCallback;
TCallBack = FMX.Helpers.Android.TCallBack;
{$ELSEIF DECLARED(System.Classes.TThreadMethod)}
TMethodCallback = System.Classes.TThreadMethod;
TCallBack = System.Classes.TThreadProcedure;
{$ENDIF} // System.Threading
procedure CallInUIThread(const AMethod: TMethodCallback); overload;
procedure CallInUIThread(const AMethod: TCallBack); overload;
implementation
procedure CallInUIThread(const AMethod: TMethodCallback);
begin
{$IF DECLARED(FMX.Helpers.Android.CallInUIThread)}
FMX.Helpers.Android.CallInUIThread(AMethod);
{$ELSE}
TThread.ForceQueue(nil, AMethod);
{$ENDIF}
end;
procedure CallInUIThread(const AMethod: TCallBack);
begin
{$IF DECLARED(FMX.Helpers.Android.CallInUIThread)}
FMX.Helpers.Android.CallInUIThread(AMethod);
{$ELSE}
TThread.ForceQueue(nil, AMethod);
{$ENDIF}
end;
end.