[fpc-pascal] Thread problem
Travis Siegel
tsiegel at softcon.com
Sun Sep 6 20:06:53 CEST 2020
I'm not sure it works properly on windows.
When I modify this to start two threads, and print out messages based on
their start/stop times, as well as a message inside the thread, I get
both ending messages before I get only a single printout from within the
threaded function. This seems to indicate windows isn't starting two
threads, though I don't have a clue how to verify this.
Just thought I'd add fuel to the fire here. :)
On 9/6/2020 1:00 PM, Paul Renaud via fpc-pascal wrote:
> I
> Hello,
>
> I'm having a problem with the OS/2 version of the compiler.
>
> This simplified version of my program keeps generating an exception
> when compiled and run in EComStation 1.2, OS/2 versions 4.5 and 4
> but runs fine when compiled for Windows.
>
> Program Test1( Input, Output );
>
> {$S+}
>
> Const
> StackSize = 1000000;
>
> Max_Array = 5000;
>
> Type
> Data_Array = packed array[ 0 .. Max_Array ] of LongInt;
>
> Function MyThread( P: Pointer ): PtrInt;
> Var
> Data: Data_Array;
> Indexer: LongInt;
> Begin
> MyThread := 0;
> For Indexer := 1 to Max_Array do
> Data[ Indexer ] := 0;
> End;
>
> Var
> Handle: LongWord;
> My_Result: LongInt;
> Begin
> WriteLn( 'Test1 starting' );
> My_Result := BeginThread( @MyThread, Nil, Handle, StackSize );
>
> My_Result := WaitForThreadTerminate( Handle, 0 );
> WriteLn( 'Test1 finished' );
> End.
>
> The error generated is...
>
> SYS1808:
> The process has stopped. The sofware diagnostic
> code (exception code) is 0005.
>
> the command I used to compile it is:
>
> fpc Test1.pas -Se -gl
>
> This exception appears to be generated before my thread gets control,
> so I can't install my own exception handlers to intercept it.
>
> Any help would be appreciated.
> Thanks,
> Paul.
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200906/cdb80d98/attachment.htm>
More information about the fpc-pascal
mailing list