2021年12月25日 星期六

Thread Programmierung

 

Thread Programmierung unter Windows mit Delphi

 1 Thread Programmierung unter Windows mit Delphi Michael Puff

 oder dem von ExitThread oder TerminateThread festgelegten Wert, ... Mit dem Gegenstück zu SetThreadPriority, GetThreadPriority, lässt sich die aktuelle ...

 https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.TThread.Terminate

 https://stackoverflow.com/questions/12475395/delphi-threading

  Thread   Delphi SetThreadPriority GetThreadPriority   SetThreadPriorityBoost  GetThreadPriorityBoost   ExitThread  TerminateThread   GetExitCodeThread   CloseHandle

SwitchToThread  切換到另一個可排程執行緒 CreateThread  建立執行緒 CreateRemoteThread  建立遠端執行緒 GetCurrentThread  獲取執行緒控制代碼 GetCurrentThreadId  獲取執行緒ID OpenThread  開啟一個現有執行緒物件 SetThreadPriority  設定執行緒優先順序 GetThreadPriority  獲取執行緒優先順序 SetThreadPriorityBoost  設定開關–系統動態提升該執行緒的優先順序 GetThreadPriorityBoost  獲取~開關 ExitThread  線上程的執行過程中終止 TerminateThread  線上程的外面終止 GetExitCodeThread  獲取一個已中止執行緒的退出程式碼 SuspendThread  暫停執行緒 ResumeThread  恢復執行緒 SetThreadStackGuarantee  要求系統在丟擲EXCEPTION_STACK_OVERFLOW異常的時候,保證仍然有指定大小的空閒區可以用 WaitForSingleObject  阻塞,直到等到訊號 CloseHandle  關閉控制代碼 


Yield SpinWait Sleep SwitchToThread SuspendThread ResumeThread
 System.Threading mscorlib.dll, netstandard.dll  Thread.dll Thread.Interrupt

https://coderoad.ru/12751031/%D0%9A%D0%B0%D0%BA%D0%BE%D0%B9-%D0%BC%D0%B5%D1%82%D0%BE%D0%B4-%D0%BE%D0%B6%D0%B8%D0%B4%D0%B0%D0%BD%D0%B8%D1%8F-%D0%B2%D1%8B%D0%B7%D0%B2%D0%B0%D1%82%D1%8C-%D0%B2-%D0%B1%D0%B5%D1%81%D0%BA%D0%BE%D0%BD%D0%B5%D1%87%D0%BD%D0%BE%D0%BC-%D0%BF%D0%BE%D1%82%D0%BE%D0%BA%D0%B5-%D0%BE%D0%B6%D0%B8%D0%B4%D0%B0%D0%BD%D0%B8%D1%8F-%D0%B4%D0%BB%D1%8F-Delphi-XE2

unit ThreadPool;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, contnrs, syncobjs;


    type

    TpooledTask=class(TObject)
    private
      FonComplete:TNotifyEvent;
    protected
      Fparam:TObject;
      procedure execute; virtual; abstract;
    public
      constructor create(onComplete:TNotifyEvent;param:TObject);
    end;

    TThreadPool=class(TObjectQueue)
    private
      access:TcriticalSection;
      taskCounter:THandle;
      threadCount:integer;
    public
      constructor create(initThreads:integer);
      procedure addTask(aTask:TpooledTask);
    end;

    TpoolThread=class(Tthread)
    private
      FmyPool:TThreadPool;
    protected
      procedure Execute; override;
    public
      constructor create(pool:TThreadPool);
    end;

    implementation

    { TpooledTask }

    constructor TpooledTask.create(onComplete: TNotifyEvent; param: TObject);
    begin
      FonComplete:=onComplete;
      Fparam:=param;
    end;

    { TThreadPool }

    procedure TThreadPool.addTask(aTask: TpooledTask);
    begin
      access.acquire;
      try
        push(aTask);
      finally
        access.release;
      end;
      releaseSemaphore(taskCounter,1,nil); // release one unit to semaphore
    end;

    constructor TThreadPool.create(initThreads: integer);
    begin
      inherited create;
      access:=TcriticalSection.create;
      taskCounter:=createSemaphore(nil,0,maxInt,'');
      while(threadCount<initThreads) do
      begin
        TpoolThread.create(self);
        inc(threadCount);
      end;
    end;

    { TpoolThread }

    constructor TpoolThread.create(pool: TThreadPool);
    begin
      inherited create(true);
      FmyPool:=pool;
      FreeOnTerminate:=true;
      resume;
    end;

    procedure TpoolThread.execute;
    var thisTask:TpooledTask;
    begin
      while (WAIT_OBJECT_0=waitForSingleObject(FmyPool.taskCounter,INFINITE)) do
      begin
        FmyPool.access.acquire;
        try
          thisTask:=TpooledTask(FmyPool.pop);
        finally
          FmyPool.access.release;
        end;
        thisTask.execute;
        if assigned(thisTask.FonComplete) then thisTask.FonComplete(thisTask);
      end;
    end;

    end.


https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Threading.TTask

System.Threading


TTask

TParallel
TFuture
TThreadPool
TWorkStealingQueue

https://docwiki.embarcadero.com/Libraries/Sydney/en/System.SyncObjs
SyncObjs

TMutex
 
TCriticalSection
TSemaphore
TEvent
TThread
THandleObject
TConditionVariableCS
TConditionVariableMutex
TConditionVariableHelper
TCriticalSectionHelper





https://www.modernescpp.com/index.php/tasks

https://blog.marcocantu.com/blog/2017-november-explaining-tasks-ppl-too-many.html

https://www.embarcaderoacademy.com/p/anonymous-methods-in-delphi/

https://www.embarcaderoacademy.com/p/master-modern-delphi-language-techniques

https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_Critical_Sections



https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_Critical_Sections

https://docwiki.embarcadero.com/RADStudio/Sydney/en/Locking_Objects

https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_the_Main_VCL_Thread

https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_the_Multi-read_Exclusive-write_Synchronizer

https://www.informit.com/articles/article.aspx?p=30382&seqNum=6




https://github.com/pocoproject/poco

https://docs.microsoft.com/zh-tw/dotnet/standard/threading/pausing-and-resuming-threads


https://docwiki.embarcadero.com/RADStudio/Sydney/en/Service_Threads

  SparkyThread.Suspend; SparkyThread.Resume;

https://docwiki.embarcadero.com/Libraries/Alexandria/en/Vcl.SvcMgr.TService.OnExecute

https://docwiki.embarcadero.com/Libraries/Sydney/en/System.SyncObjs

https://stackoverflow.com/questions/67246114/delphi-what-happens-when-the-app-terminates-while-a-thread-is-waiting-on-an-even

https://www.freepascal.org/docs-html/rtl/classes/tthread.html

delphi System Threading Thread.Interrupt AutoResetEvent Wait  Set

kernel32  Thread Scheduling Yield  setThreadPriority           SetThreadPriority(pi.hThread, THREAD_PRIORITY_IDLE); ResumeThread(pi.hThread);

https://docwiki.embarcadero.com/CodeExamples/Sydney/en/TThreadYield_(Delphi)


Game Development in Delphi

 https://stackoverflow.com/questions/8203166/game-development-in-delphi
Game Development in Delphi


http://delphi.org/2011/10/pascal-game-development/
48 – Pascal Game Development with Jason McMillen


Pascal eXtended Library

 FPC produce COFF files. AFAIK, Delphi won't link to ELF files.
https://stackoverflow.com/questions/48714279/using-fpc-o-files-in-delphi-2010
https://www.agner.org/optimize/#objconv

AsphyreSphinx framework to draw 2D DirectX scene on form canvas.
Asphyre Sphinx
https://asphyre.net/products/legacy/7-asphyresphinx

https://www.pascalgamedevelopment.com/content.php
pascalgamedevelopment.com

http://delphi.org/2011/10/pascal-game-development/

http://www.pp4s.co.uk/

https://github.com/GLScene/GLScene

https://github.com/sszczep/ray-casting-in-2d-game-engines

https://castle-engine.io/
Castle Game Engine
Cross-platform (desktop, mobile, console) 3D and 2D game engine supporting many asset formats (glTF, X3D, Spine...) and using modern Object Pascal

https://sourceforge.net/projects/andorra/
Andorra 2D


http://zengl.org/
ZenGL - cross-platform game development library written in Pascal, designed to provide necessary functionality for rendering 2D-graphics, handling input, sound output, etc. More details can be found here.

https://delphigl.com/

http://www.clootie.ru/
Clootie graphics pages
DirectX 10 SDK for Delphi / FreePascal update.
Updated Direct3D10 / D3DX10 headers to March-2009 SDK. Now with Direct3D 10.1 support.

http://www.zgameeditor.org/
 ZGameEditor
Create games that have a redistributable size of only 64kb or less using procedural content. The game engine use OpenGL for graphics and a real time synthesizer for audio. ZGE is Free Open Source Software.



https://gcup.ru/load/engines/asphyre/3-1-0-105

Asphyre Sphinx 3
Скачать удаленно (17 Мб.) Скриншот     30 Июня 2008, 19:02
Логотип Asphyre Sphinx
Жанровая направленность: 2D/3D-игры любого жанра и типа;
Платформа: 32/64-bit Windows XP/Vista/7, 32/64-bit Linux и Mac OS X, iOS;

    DGLEngine
    ZenGL
    Ogre3D
    GLScene
    HiAsm
    3DCakeWalk
    Unigine
    CAST II
    SpriteCraft
    Digital Wizard's Lab
    LKI-Creator
    LKI-Creator 3D
    Nytro Game Engine
    K5Engine
    Axiom Engine
    eXgine
    WindMill
    Kochol
    Urho3D
    OpenBlox










fibonacci spiral art illustrator 黃金螺線 黃金分割線 黃金比例 黃金矩形 黃金三角形

 Interior and exterior design. Forged items. The fence is

metal. Artistic forging  Gate Forged Metal Grill Artistic Forging

ratio geometric concept. Fibonacci spiral Golden ratio.Geometric shapes Scalable vector illustration
 
Classic Black Decorative Metal Scroll Motif Wall Hanging Serafina Metal Scroll Wall Art Rectangular

Stratton  Decor Traditional Scroll  Sculpture

Яндекс.Картинки: поиск изображений в интернете, поиск по изображению

Scroll Bending Machine - Ellsen Scroll Machines

Practical Geometry for Builders and Architects Metal Bender

 

https://en.wikipedia.org/wiki/Golden_spiral 


fibonacci spiral art illustrator 

黃金螺線

黃金分割線 

黃金比例 

黃金矩形

黃金三角形