Delphi11的多线程ⓞ,附送图片处理代码

Delphi11的多线程ⓞ

OLD Coder , 习惯使用Pascal 接下来准备启用多线程,毕竟硬件多核,Timer不太爽了(曾经的桌面,都是Timer——理解为“片”)

突然想写写,不知道还有多少D兄弟们在。

从源码开始

用D11之前用D7,为了兼容现在的“大WEB”(utf8Code,你猜用来写的什么?)只能升级到高版本——的确提供了很多的系功能,比如Mysql、SQLITE等。
用Delphi一切必须从源码开始——不要问为什么!

在D7这里插入图片描述

D7中的 TThread

~ 依然没有Pascal代码块~

  TThread = class
  private
{$IFDEF MSWINDOWS}
    FHandle: THandle;
    FThreadID: THandle;
{$ENDIF}
{$IFDEF LINUX}
    // ** FThreadID is not THandle in Linux **
    FThreadID: Cardinal;
    FCreateSuspendedSem: TSemaphore;
    FInitialSuspendDone: Boolean;
{$ENDIF}
    FCreateSuspended: Boolean;
    FTerminated: Boolean;
    FSuspended: Boolean;
    FFreeOnTerminate: Boolean;
    FFinished: Boolean;
    FReturnValue: Integer;
    FOnTerminate: TNotifyEvent;
    FSynchronize: TSynchronizeRecord;
    FFatalException: TObject;
    procedure CallOnTerminate;
    class procedure Synchronize(ASyncRec: PSynchronizeRecord); overload;
{$IFDEF MSWINDOWS}
    function GetPriority: TThreadPriority;
    procedure SetPriority(Value: TThreadPriority);
{$ENDIF}
{$IFDEF LINUX}
    // ** Priority is an Integer value in Linux
    function GetPriority: Integer;
    procedure SetPriority(Value: Integer);
    function GetPolicy: Integer;
    procedure SetPolicy(Value: Integer);
{$ENDIF}
    procedure SetSuspended(Value: Boolean);
  protected
    procedure CheckThreadError(ErrCode: Integer); overload;
    procedure CheckThreadError(Success: Boolean); overload;
    procedure DoTerminate; virtual;
    procedure Execute; virtual; abstract;
    procedure Synchronize(Method: TThreadMethod); overload;
    property ReturnValue: Integer read FReturnValue write FReturnValue;
    property Terminated: Boolean read FTerminated;
  public
    constructor Create(CreateSuspended: Boolean);
    destructor Destroy; override;
    procedure AfterConstruction; override;
    procedure Resume;
    procedure Suspend;
    procedure Terminate;
    function WaitFor: LongWord;
    class procedure Synchronize(AThread: TThread; AMethod: TThreadMethod); overload;
    class procedure StaticSynchronize(AThread: TThread; AMethod: TThreadMethod);
    property FatalException: TObject read FFatalException;
    property FreeOnTerminate: Boolean read FFreeOnTerminate write FFreeOnTerminate;
{$IFDEF MSWINDOWS}
    property Handle: THandle read FHandle;
    property Priority: TThreadPriority read GetPriority write SetPriority;
{$ENDIF}
{$IFDEF LINUX}
    // ** Priority is an Integer **
    property Priority: Integer read GetPriority write SetPriority;
    property Policy: Integer read GetPolicy write SetPolicy;
{$ENDIF}
    property Suspended: Boolean read FSuspended write SetSuspended;
{$IFDEF MSWINDOWS}
    property ThreadID: THandle read FThreadID;
{$ENDIF}
{$IFDEF LINUX}
    // ** ThreadId is Cardinal **
    property ThreadID: Cardinal read FThreadID;
{$ENDIF}
    property OnTerminate: TNotifyEvent read FOnTerminate write FOnTerminate;
  end;

在这里插入图片描述

D11中的TThread

  TThread = class
  private type
    PSynchronizeRecord = ^TSynchronizeRecord;
    TSynchronizeRecord = record
      FThread: TObject;
      FMethod: TThreadMethod;
      FProcedure: TThreadProcedure;
      FSynchronizeException: TObject;
      FExecuteAfterTimestamp: Int64;
      procedure Init(AThread: TObject; const AMethod: TThreadMethod); overload;
      procedure Init(AThread: TObject; const AProcedure: TThreadProcedure); overload;
    end;
    TOnSynchronizeProc = reference to procedure (AThreadID: TThreadID; var AQueueEvent: Boolean;
      var AForceQueue: Boolean; var AMethod: TThreadMethod; var AProcedure: TThreadProcedure);
  private class var
    FProcessorCount: Integer;
    FOnSynchronize: TOnSynchronizeProc;
  private
    FThreadID: TThreadID;
{$IF Defined(MSWINDOWS)}
    FHandle: THandle platform;
{$ELSEIF Defined(POSIX)}
    FCreateSuspendedMutex: pthread_mutex_t;
    FInitialSuspendDone: Boolean;
    FResumeEvent: sem_t;
{$ENDIF POSIX}
    FStarted: Boolean;
    FCreateSuspended: Boolean;
    [HPPGEN('volatile bool FTerminated')]
    FTerminated: Boolean;
    FSuspended: Boolean;
    FFreeOnTerminate: Boolean;
    [HPPGEN('volatile bool FFinished')]
    FFinished: Boolean;
    FReturnValue: Integer;
    FOnTerminate: TNotifyEvent;
    FFatalException: TObject;
    FExternalThread: Boolean;
    FShutdown: Boolean;
    class constructor Create;
    class destructor Destroy;
    procedure CallOnTerminate;
    class procedure Synchronize(ASyncRec: PSynchronizeRecord; QueueEvent: Boolean = False;
      ForceQueue: Boolean = False); overload;
    class function GetCurrentThread: TThread; static;
    class function GetIsSingleProcessor: Boolean; static; inline;
    procedure InternalStart(Force: Boolean);
{$IF Defined(MSWINDOWS)}
    function GetPriority: TThreadPriority; platform;
    procedure SetPriority(Value: TThreadPriority); platform;
{$ELSEIF Defined(POSIX)}
    function GetPriority: Integer; platform;
    procedure SetPriority(Value: Integer); platform;
    function GetPolicy: Integer; platform;
    procedure SetPolicy(Value: Integer); platform;
{$ENDIF POSIX}
    procedure SetSuspended(Value: Boolean);
  private class threadvar
    [Unsafe] FCurrentThread: TThread;
  protected
    procedure CheckThreadError(ErrCode: Integer); overload;
    procedure CheckThreadError(Success: Boolean); overload;
    procedure DoTerminate; virtual;
    procedure TerminatedSet; virtual;
    procedure Execute; virtual; abstract;
    procedure Queue(AMethod: TThreadMethod); overload; inline;
    procedure Synchronize(AMethod: TThreadMethod); overload; inline;
    procedure Queue(AThreadProc: TThreadProcedure); overload; inline;
    procedure Synchronize(AThreadProc: TThreadProcedure); overload; inline;
    procedure SetFreeOnTerminate(Value: Boolean);
    procedure ShutdownThread; virtual;
    class procedure InitializeExternalThreadsList;
    property ReturnValue: Integer read FReturnValue write FReturnValue;
    property Terminated: Boolean read FTerminated;
  public type
    TSystemTimes = record
      IdleTime, UserTime, KernelTime, NiceTime: UInt64;
    end;
  public
    constructor Create; overload;
    constructor Create(CreateSuspended: Boolean); overload;
{$IF Defined(MSWINDOWS)}
    constructor Create(CreateSuspended: Boolean; ReservedStackSize: NativeUInt); overload;
{$ENDIF MSWINDOWS}
    destructor Destroy; override;
    // CreateAnonymousThread will create an instance of an internally derived TThread that simply will call the
    // anonymous method of type TProc. This thread is created as suspended, so you should call the Start method
    // to make the thread run. The thread is also marked as FreeOnTerminate, so you should not touch the returned
    // instance after calling Start as it could have run and is then freed before another external calls or
    // operations on the instance are attempted.
    class function CreateAnonymousThread(const ThreadProc: TProc): TThread; static;
    procedure AfterConstruction; override;
    procedure BeforeDestruction; override;
    // This function is not intended to be used for thread synchronization.
    procedure Resume; deprecated;
    // Use Start after creating a suspended thread.
    procedure Start;
    // This function is not intended to be used for thread synchronization.
    procedure Suspend; deprecated;
    procedure Terminate;
    function WaitFor: LongWord;
{$IF Defined(POSIX)}
    // Use Schedule on Posix platform to set both policy and priority. This is useful
    // when you need to set policy to SCHED_RR or SCHED_FIFO, and priority > 0. They
    // cannot be set sequentionally using Policy and Priority properties. Setting
    // policy to SCHED_RR or SCHED_FIFO requires root privileges.
    procedure Schedule(APolicy, APriority: Integer);
{$ENDIF POSIX}
    // NOTE: You can only call CheckTerminated and SetReturnValue on an internally created thread.
    // Calling this from an externally created thread will raise an exception
    // Use TThread.CheckTerminated to check if the Terminated flag has been set on the current thread
    class function CheckTerminated: Boolean; static;
    // Use TThread.SetReturnValue to set the current thread's return value from code that doesn't have
    // direct access to the current thread
    class procedure SetReturnValue(Value: Integer); static;
    class procedure Queue(const AThread: TThread; AMethod: TThreadMethod); overload; static;
    class procedure Queue(const AThread: TThread; AThreadProc: TThreadProcedure); overload; static;
    class procedure RemoveQueuedEvents(const AThread: TThread; AMethod: TThreadMethod); overload; static;
    class procedure StaticQueue(const AThread: TThread; AMethod: TThreadMethod); static; deprecated 'From C++ just use Queue now that it is just a static method';
    class procedure Synchronize(const AThread: TThread; AMethod: TThreadMethod); overload; static;
    class procedure Synchronize(const AThread: TThread; AThreadProc: TThreadProcedure); overload; static;
    class procedure StaticSynchronize(const AThread: TThread; AMethod: TThreadMethod); static; deprecated 'From C++ just use Synchronize now that it is just a static method';
    /// <summary>
    ///    Queue the method to delay its  synchronous execution. Unlike the Queue method, this will queue it even
    ///    if the caller is in the main thread.
    /// </summary>
    class procedure ForceQueue(const AThread: TThread; const AMethod: TThreadMethod; ADelay: Integer = 0); overload; static;
    /// <summary>
    ///    Queue the procedure to delay its synchronous execution. Unlike the Queue method, this will queue it even
    ///    if the caller is in the main thread.
    /// </summary>
    class procedure ForceQueue(const AThread: TThread; const AThreadProc: TThreadProcedure; ADelay: Integer = 0); overload; static;
    class procedure RemoveQueuedEvents(const AThread: TThread); overload; static;
    class procedure RemoveQueuedEvents(AMethod: TThreadMethod); overload; static; inline;
{$IFNDEF NEXTGEN}
    class procedure NameThreadForDebugging(AThreadName: AnsiString; AThreadID: TThreadID = TThreadID(-1)); overload; static; //deprecated 'Use without AnsiString cast';
{$ENDIF !NEXTGEN}
    class procedure NameThreadForDebugging(AThreadName: string; AThreadID: TThreadID = TThreadID(-1)); overload; static;
    class procedure SpinWait(Iterations: Integer); static;
    class procedure Sleep(Timeout: Integer); static;
    class procedure Yield; static;
    // Call GetSystemTimes to get the current CPU ticks representing the amount of time the system has
    // spent Idle, in User's code, in Kernel or System code and Nice. For many systems, such as Windows,
    // the NiceTime is 0. NOTE: The KernelTime field also include the amount of time the system has been Idle.
    class function GetSystemTimes(out SystemTimes: TSystemTimes): Boolean; static;
    // Using the previously acquired SystemTimes structure, calculate the average time that the CPU has been
    // executing user and kernel code. This is the current CPU load the system is experiencing. The return value
    // is expressed as a percentage ranging from 0 to 100. NOTE: The passed in PrevSystemTimes record is updated
    // with the current system time values.
    class function GetCPUUsage(var PrevSystemTimes: TSystemTimes): Integer; static;
    // Returns current value in milliseconds of an internal system counter
    class function GetTickCount: Cardinal; static;
    // Returns current value in milliseconds of an internal system counter with 64bits
    class function GetTickCount64: UInt64; static;
    /// <summary>
    ///    Returns True if after AStartTime the specified ATimeout is passed.
    ///    When ATimeout <= 0, then timeout is inifinite and function always returns False.
    /// </summary>
    class function IsTimeout(AStartTime: Cardinal; ATimeout: Integer): Boolean; static;
    property ExternalThread: Boolean read FExternalThread;
    property FatalException: TObject read FFatalException;
    property FreeOnTerminate: Boolean read FFreeOnTerminate write SetFreeOnTerminate;
    property Finished: Boolean read FFinished;
{$IF Defined(MSWINDOWS)}
    property Handle: THandle read FHandle;
    property Priority: TThreadPriority read GetPriority write SetPriority;
{$ELSEIF Defined(POSIX)}
    // ** Priority is an Integer **
    property Priority: Integer read GetPriority write SetPriority;
    property Policy: Integer read GetPolicy write SetPolicy;
{$ENDIF POSIX}
    // Started is set to true once the thread has actually started running after the initial suspend.
    property Started: Boolean read FStarted;
    property Suspended: Boolean read FSuspended write SetSuspended;
    property ThreadID: TThreadID read FThreadID;
    property OnTerminate: TNotifyEvent read FOnTerminate write FOnTerminate;
    /// <summary>
    ///    The currently executing thread. This is the same as TThread.CurrentThread.
    /// </summary>
    class property Current: TThread read GetCurrentThread;
    /// <summary>
    ///    The currently executing thread. This is the same as TThread.Current.
    ///    Please use TThread.Current, which is more clear and less redundant.
    /// </summary>
    class property CurrentThread: TThread read GetCurrentThread;
    /// <summary>
    ///    The number of processor cores on which this application is running. This will include virtual
    ///    "Hyper-threading" cores on many modern Intel CPUs. It is ultimately based on what the underlying
    ///    operating system reports.
    /// </summary>
    class property ProcessorCount: Integer read FProcessorCount;
    /// <summary>
    ///    Simple Boolean property to quickly determine wether running on a single CPU based system.
    /// </summary>
    class property IsSingleProcessor: Boolean read GetIsSingleProcessor;
    /// <summary>
    ///    Event handler, which is called before each Synchronize or Queue call.
    /// </summary>
    class property OnSynchronize: TOnSynchronizeProc read FOnSynchronize write FOnSynchronize;
  end;

慢慢开始,我的需求很简单,从Timer改为Thread
第一步、启动线程优雅的执行耗时功能
第二部、启动线程池,让低配的硬件发光发热。
第三步、“论旧举杯先下泪,伤离临水更登楼。”

先去研究下这两段代码

无具体内容附送一段刚D11图片处理的代码:

1、引用单元

interface
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Mask, Vcl.ExtCtrls,
  IdTCPConnection, IdTCPClient, IdHTTP, IdBaseComponent, IdComponent,
  IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL,
  HtmlParserEx, Vcl.ComCtrls,Winapi.Wincodec;
implementation
uses IdURI,Winapi.UrlMon,Jpeg,inifiles,RegularExpressions,Masks;

2、调用过程

procedure TForm1.Button1Click(Sender: TObject);
var I:Integer;
    s:String;
    SaveToFileName,sTitle,reFileName :String;
begin
    SaveToFileName:=Trim(edtTitle.Text);
    if chbxDownAll.Checked then
    begin
        for I := 0 to scMainTree.Items.Count-1 do
        begin
            if doFind( 0, scMainTree.Items[I] ) then
            begin
                if doWownCurrent(reFileName) then
                begin
                    C_FormatPicture_Fix( reFileName,FWorkPath+trim(edtSubDir.Text)+'\',SaveToFileName, 800, 320,0 );
                end;

                if not chbxDownAll.Checked then
                Break;
            end;
        end;
    end
    else
    begin
        //编辑图片
        if doWownCurrent(reFileName) then
        begin
            C_FormatPicture_Fix( reFileName,FWorkPath+trim(edtSubDir.Text)+'\',SaveToFileName, 800, 320,100 );
            btnFindClick(nil);
        end;
    end;
end;

调试代码

3、实现单元引用

4、代码

// 优先缩放到固定高度,不满足缩放到宽度
function TForm1.C_FormatPicture_Fix(reFileName: String;SavePath:String;SaveToFileName:String;DestWidth,DestHeight:integer;ACompressionQuality:word): Boolean;
var w: TWICImage;
    nWIF: IWICImagingFactory;
    nWIS: IWICBitmapScaler;
    j: TJPEGImage;
    d:TBitmap;
    cmode:Integer;
begin
   Result:=False;
   Try
   w:= TWICImage.Create;
   if not FileExists(reFilename) then Exit;
   w.LoadFromFile(reFilename);
   if ( w.Height < DestHeight ) and ( w.Width < DestWidth ) then Exit;
   //放缩模糊
   //放缩到 DestHeight
   nWIF := w.ImagingFactory;
   nWIF.CreateBitmapScaler(nWIS);
   nWIS.Initialize(w.Handle, round( w.Width*DestHeight / w.Height ), DestHeight , WICBitmapInterpolationModeFant);
   w.Handle := IWICBitmap(nWIS);  nWIS := nil;  nWIF := nil;
   //高度满足
   if (w.width >= DestWidth) then
   begin
        cMode:=1;
        result:=true;
   end
   else
   begin
       //w.LoadFromFile(reFilename); 放缩到宽度
       nWIS := nil;  nWIF := nil;
       nWIF := w.ImagingFactory;
       nWIF.CreateBitmapScaler(nWIS);
       nWIS.Initialize(w.Handle, DestWidth, round( w.Height*DestWidth / w.Width ) , WICBitmapInterpolationModeFant);
       w.Handle := IWICBitmap(nWIS);  nWIS := nil;  nWIF := nil;
       if (w.Height > DestHeight) then
       begin
            cMode:=2;
            Result:=true;
       end;
   end;
   if not Result then Exit;
   Result:=False;

   //Result:=True; cMode:=1;
   //w.SaveToFile(ExtractFilePath(refilename)+'_TTTTT_'+ExtractFileName(refilename)+'.jpg');

   j:= TJPEGImage.Create;
   j.Assign(w);

   d:= TBitmap.Create;
   d.Width:=DestWidth;
   d.Height:=DestHeight;
   if cMode=1 then
       //固定宽度
       d.Canvas.CopyRect(Rect(0,0,DestWidth,DestHeight),j.Canvas,
            Rect(  round( (j.Width-DestWidth) / 2)  , 0, DestWidth,DestHeight))
   else //固定高度
       d.Canvas.CopyRect(Rect(0,0,DestWidth,DestHeight),j.Canvas,
            Rect(  0  ,round( (j.Height-DestHeight) / 2),DestWidth,DestHeight));

   j.Assign(d);
   if ACompressionQuality in [1..100] then
   begin
    j.CompressionQuality := 100;//PressQuality;
    j.Compress;
   end;

   j.SaveToFile ( SavePath+'_M_'+SaveToFileName+'.jpg' );

   Result:=True;
   Finally
     if assigned(w) then FreeAndNil(w);
     if assigned(j) then FreeAndNil(j);
     if assigned(d) then FreeAndNil(d);
   End;
end;

简单裁剪,穷人需要小体积图,懂得点赞。

说明:网络放缩部分参考自网络。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/25543.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

mybatisplus递归传递多个参数 | mybatisplus传递多个参数获取层级数据 | mybatisplus传递多个参数获取树形数据

搜索关键字&#xff1a; mybatisplus关联查询传递参数|"select""树形结构"|"select""树形结构""传参"| "select""many""传参"| "select""column""传参" 1、…

内置工具横向移动

IPCSchtasks IPC: IPC$是共享"命令管道"的资源&#xff0c;它是为了让进程通信而开放的命名管道&#xff0c;连接双方可以建立安全的通道并以此通道进行加密数据交换&#xff0c;从而实现对远程计算机的访问。 利用条件&#xff1a; 1、开放139、445 2、目标开启…

SAP-MM-采购申请审批那些事!

1、ME55不能审批删除行项目的PR 采购申请审批可以设置行项目审批或抬头审批。如果设置为抬头审批时&#xff0c;ME55集中审批时&#xff0c;就会发现有些采购申请时不能审批的&#xff0c; 那么这些采购申请时真的不需要审批么&#xff1f;不是的&#xff0c;经过核对这些采购申…

【每周一书】--(认知觉醒)思考:如何用清爽的情绪面对内卷的当下?

【每周一书】--&#xff08;认知觉醒&#xff09;思考&#xff1a;如何用清爽的情绪面对内卷的当下&#xff1f; 认知觉醒&#xff1a;开启自我改变的原动力焦虑&#xff1a;焦虑的根源完成焦虑定位焦虑选择焦虑环境焦虑难度焦虑 如何拥有清爽的情绪&#xff0c;释放焦虑情绪 认…

STM32F407单片机HAL库CAN2不能接收数据解决方法

最近在使用stm32F407的片子调试can通信&#xff0c;直接在正点原子的代码上修改调试&#xff0c;调试can1的时候&#xff0c;基本没啥问题&#xff0c;收发都正常&#xff0c;使用查询模式和中断模式都可以。但是当修改到can2的时候&#xff0c;可以正常发送数据&#xff0c;但…

WPF 热重载失效了

关于 热重载官方说明&#xff1a; WPF 和 UWP 应用的 XAML 热重载是什么Introducing the .NET Hot Reload experience for editing code at runtime 热重载简单来说&#xff0c;就是点击运行程序后&#xff0c;修改 XAML 代码&#xff0c;应用程序会实时的显示你的修改 为…

Python入门(十三)函数(一)

函数&#xff08;一&#xff09; 1.函数概述2.函数定义2.1向函数传递信息2.2实参和形参 作者&#xff1a;xiou 1.函数概述 函数是带名字的代码块&#xff0c;用于完成具体的工作。要执行函数定义的特定任务&#xff0c;可调用该函数。需要在程序中多次执行同一项任务时&#…

中间件SOME/IP简述

SOME/IP SOME/IP 不是广义上的中间件&#xff0c;严格的来讲它是一种通信协议&#xff0c;但中间件这个概念太模糊了&#xff0c;所以我们也一般称 SOME/IP 为通信中间件。 SOME/IP 全称是 Scalable service-Oriented MiddlewarE over IP。也就是基于 IP 协议的面向服务的可扩…

使用Python绘制M2货币供应率曲线

M2广义货币供应量&#xff1a;流通于银行体系之外的现金加上企业存款、居民储蓄存款以及其他存款&#xff0c;它包括了一切可能成为现实购买力的货币形式&#xff0c;通常反映的是社会总需求变化和未来通胀的压力状态。近年来&#xff0c;很多国家都把M2作为货币供应量的调控目…

ChatGPT国内免费使用方法【国内免费使用地址】

当下人工智能技术的快速发展&#xff0c;聊天机器人成为了越来越多人们日常生活和工作中的必备工具。如何在国内免费使用ChatGPT聊天机器人&#xff0c;成为了热门话题。本文将为你详细介绍ChatGPT国内免费使用方法&#xff0c;让你轻松拥有聊天机器人助手&#xff0c;提高工作…

Vue3 小兔鲜:Pinia入门

Vue3 小兔鲜&#xff1a;Pinia入门 Date: May 11, 2023 Sum: Pinia概念、实现counter、getters、异步action、storeToRefs保持响应式解构 什么是Pinia Pinia 是 Vue 的专属状态管理库&#xff0c;可以实现跨组件或页面共享状态&#xff0c;是 vuex 状态管理工具的替代品&…

论文学习笔记:Swin Transformer: Hierarchical Vision Transformer using Shifted Windows

论文阅读&#xff1a;Swin Transformer: Hierarchical Vision Transformer using Shifted Windows 今天学习的论文是 ICCV 2021 的 best paper&#xff0c;Swin Transformer&#xff0c;可以说是 transformer 在 CV 领域的一篇里程碑式的工作。文章的标题是一种基于移动窗口的…

C++异步调用方法

C之future和promise future和promise的作用是在不同线程之间传递数据。使用指针也可以完成数据的传递&#xff0c;但是指针非常危险&#xff0c;因为互斥量不能阻止指针的访问&#xff1b;而且指针的方式传递的数据是固定的&#xff0c;如果更改数据类型&#xff0c;那么还需要…

代码随想录算法训练营第四十六天|139.单词拆分、关于多重背包,你该了解这些!、背包问题总结篇!

文章目录 一、139.单词拆分二、关于多重背包&#xff0c;你该了解这些&#xff01;三、背包问题总结篇&#xff01;总结 一、139.单词拆分 public boolean wordBreak(String s, List<String> wordDict) {//完全背包问题&#xff0c;因为可以重复&#xff0c;背包正序排列…

ROS:ROS是什么

目录 一、ROS简介二、ROS可以做些什么三、ROS特征四、ROS特点4.1点对点设计4.2不依赖编程语言4.3精简与集成4.4便于测试4.5开源4.6强大的库与社区 五、ROS的发展六、ROS架构6.1OS层6.2中间层6.3应用层 七、通信机制八、计算图8.1节点&#xff08;Node&#xff09;8.2节点管理器…

FastReport.Net FastReport.Core 2023.2.15 Crack

快速报告.NET .NET 7 的报告和文档创建库 FastReport.Net & FastReport.Core适用于 .NET 7、.NET Core、Blazor、ASP.NET、MVC 和 Windows 窗体的全功能报告库。它可以在 Microsoft Visual Studio 2022 和 JetBrains Rider 中使用。 快速报告.NET 利用 .NET 7、.NET Core、…

从零开始学习JVM(六)-直接内存和执行引擎

1 直接内存介绍 直接内存不是虚拟机运行时数据区的一部分&#xff0c;也不是《Java虚拟机规范》中定义的内存区域。直接内存是在Java堆外的、直接向系统申请的内存空间。直接内存来源于NIO&#xff0c;通过存在堆中的DirectByteBuffer操作Native内存。通常访问直接内存的速度会…

在 Linux 中启动时自动启动 Docker 容器的 2 种方法

Docker 是一种流行的容器化平台&#xff0c;允许开发人员将应用程序及其依赖项打包成一个独立的容器&#xff0c;以便在不同环境中运行。在 Linux 系统中&#xff0c;我们可以通过配置来实现在系统启动时自动启动 Docker 容器。本文将详细介绍两种方法&#xff0c;以便您了解如…

《深入理解计算机系统(CSAPP)》第9章虚拟内存 - 学习笔记

写在前面的话&#xff1a;此系列文章为笔者学习CSAPP时的个人笔记&#xff0c;分享出来与大家学习交流&#xff0c;目录大体与《深入理解计算机系统》书本一致。因是初次预习时写的笔记&#xff0c;在复习回看时发现部分内容存在一些小问题&#xff0c;因时间紧张来不及再次整理…

数据库基础——3.SQL概述及规范

这篇文章我们来讲一下SQL概述和使用规范 目录 1.SQL概述 1.1SQL背景 1.2 SQL语言排行榜 1.3 SQL分类 2.SQL规则与规范 2.1基本规则 2.2 SQL大小写规范 &#xff08;建议遵守&#xff09; 2.3 注 释 2.4 命名规则&#xff08;暂时了解&#xff09; 2.5 数据导入指令 1…