My bug or rtl bug with TThread and TThreadList?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

My bug or rtl bug with TThread and TThreadList?

Anthony Walter-3
Could someone please look at this small bit of code and tell me I have a bug or if there is something wrong with the RTL?

https://gist.github.com/sysrpl/40505d25fbd38c4404f95225f21fe0a6

SafePostThread is called from the UI thread, but a complete hangs of either thread happens after sometimes one or calls calls.

The most I get this before things go wrong:

Post message

New message

Post message


I am using FPC trunk on Linux.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: My bug or rtl bug with TThread and TThreadList?

Mattias Gaertner
On Fri, 28 Jul 2017 10:37:24 -0400
Anthony Walter <[hidden email]> wrote:

> Could someone please look at this small bit of code and tell me I have a
> bug or if there is something wrong with the RTL?
>
> https://gist.github.com/sysrpl/40505d25fbd38c4404f95225f21fe0a6

Strange code. PostMessage is already threadsafe. Maybe you found a bug
in the LCL and are trying to workaround?

 

> SafePostThread is called from the UI thread, but a complete hangs of either
> thread happens after sometimes one or calls calls.
>
> The most I get this before things go wrong:
>
> Post message
>
> New message
>
> Post message
>
>
> I am using FPC trunk on Linux.

Which Widgetset?

Mattias
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: My bug or rtl bug with TThread and TThreadList?

Anthony Walter-3
It fails on both Qt and Gtk2 linux. Please note I am not actually posting messages, that line has always been is commented.

Also, I have a different implementation that I will use, but I am still curious why this one fails.

For a background on how/when PostMessage failing, please see this issue:


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: My bug or rtl bug with TThread and TThreadList?

Anthony Walter-3
Ugh, it's my fault. 

FList.LockList;
M := FList.LockList.First; // 2nd call to enter critical section

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Loading...