[Lazarus] MultiTask library

Tomáš Emresz tomas.emresz at strankysnadno.cz
Wed Mar 29 21:53:53 CEST 2017


Hello,

i would like to present my own library which can be used as single 
thread to multithread application move.

Some description is on my github url : 
https://github.com/tomas-raul/MultiTask


For example, you have simple methods like

LoadImage(Fn : string);

and this method you run over and over - for some image tranformation 
f.e. with this :

for i := 1 to 100 do

  LoadImage(ItToStr(i)+'.jpg');

With my library (and the precompiler) - you can do the same with 
multithread like :

for i := 1 to 100 do

  LoadImage_MT_LOW(ItToStr(i)+'.jpg'); // this run this method in 
MultiTask environment with LOW priority (this is not thread priority, 
but place in task queue).

Today update is - integrated precompiler, which you can run from before 
build event and it create adekvate methods, and somethink else..

Precompiler show you help by -h param :D

Precompiler adds :

procedure Load_Image_MT( const id : integer;  const item : iSuperObject; 
const fn : string);
  procedure Load_Image_MT_Last( const id : integer;  const item : 
iSuperObject;  const fn : string);
  procedure Load_Image_MT_Low( const id : integer;  const item : 
iSuperObject;  const fn : string);
  procedure Load_Image_MT_Normal( const id : integer;  const item : 
iSuperObject;  const fn : string);
  procedure Load_Image_MT_High( const id : integer;  const item : 
iSuperObject;  const fn : string);
  procedure Load_Image_MT_ASAP( const id : integer;  const item : 
iSuperObject;  const fn : string);
  procedure Load_Image_MT_Unique( const id : integer;  const item : 
iSuperObject;  const fn : string);
  procedure Load_Image_MT_Unique_Last( const id : integer;  const item : 
iSuperObject;  const fn : string);
  procedure Load_Image_MT_Unique_Low( const id : integer;  const item : 
iSuperObject;  const fn : string);
  procedure Load_Image_MT_Unique_Normal( const id : integer;  const item 
: iSuperObject;  const fn : string);
  procedure Load_Image_MT_Unique_High( const id : integer;  const item : 
iSuperObject;  const fn : string);
  procedure Load_Image_MT_Unique_ASAP( const id : integer;  const item : 
iSuperObject;  const fn : string);

For your code :

tIQDeploy_v4 = class(TObject) {class_MT}
    published
    {$I MT_onNewWork.inc}
     procedure Load_Image(const id: integer; const item: iSuperObject; 
const fn: string); {gen_MT}
   {$I MT_def.inc}
   end;


implementation

{$I MT_impl.inc}


Tomas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170329/debc60d2/attachment-0001.html>


More information about the Lazarus mailing list