[fpc-pascal] Call function in shared library from multiple threads

silvioprog silvioprog at gmail.com
Fri Mar 31 18:45:01 CEST 2017


On Fri, Mar 31, 2017 at 1:15 PM, Henry Vermaak <henry.vermaak at gmail.com>
wrote:

> On Fri, Mar 31, 2017 at 08:42:24AM -0700, fredvs wrote:
> > > Z:\home\fred\uos\examples\uos.pas(7438,29) Warning: (4046)
> Constructing a
> > > class "TThread" with abstract method "Execute"
> >
> > Huh, is it Is it serious doctor?
>
> I use this:
>
> function DummyThread(param: pointer): ptrint;
> begin
>   Result := 0;
>   EndThread(Result);
> end;
>
> begin
>   BeginThread(@DummyThread);
>   ...
>   ...
> end.


What about calling TM directly? Something like this:

uses cthreads;
var
  TM: TThreadManager;
begin
  TM := Default(TThreadManager); // just hiding hint 'variable TM doesn't
seem to be initialized'
  GetThreadManager(TM);
  IsMultiThread := TM.InitManager;
...
end.

I can't test it now (I would like to debug it asap), but I think FPC offer
some option to start the TM without starting a new -- dummy -- thread. o.O

-- 
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170331/72e0f284/attachment.html>


More information about the fpc-pascal mailing list