Re: [fpc-pascal] My bug or rtl bug with TThread and TThreadList?
Ugh, it's my fault. FList.LockList; M := FList.LockList.First; // 2nd call to enter critical section ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] My bug or rtl bug with TThread and TThreadList?
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: https://bugs.freepascal.org/view.php?id=32209 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] My bug or rtl bug with TThread and TThreadList?
On Fri, 28 Jul 2017 10:37:24 -0400 Anthony Walterwrote: > 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 - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] My bug or rtl bug with TThread and TThreadList?
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 - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Best way to insert bytes into a TBytes variable?
On Tue, 25 Jul 2017 10:54:30 +0200, Bo Berglundwrote: >so I need to write efficient >replacements for certain string functions (Delete, Insert, Copy etc). What I am now up aginst after a few days work is to find how to code the Pos() function for strings... The comm buffer apparently contains the 2-char string as indication of the last and the existing code uses Pos() to find it. What about something like: function PosBytes(SearchItem, Target: TBytes): integer; begin ? end; What could I use inside the body of this function to mimik the string function Pos (for AnsiStrings)? -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Best way to insert bytes into a TBytes variable?
On 27/07/17 18:17, nore...@z505.com wrote: On 2017-07-25 11:00, Martok wrote: Ideally the function should be portable between FPC and Delphi XE5... You'd only need your own functions for Delphi, FPC's intrinsics such as Insert() can already work with arrays: var b, c: TBytes; begin b:= TBytes.Create(1,2,3); c:= TBytes.Create(10,11); Insert(c,b,2); -> b is now [1,2,10,11,3] The fpc wiki should probably be updated? I cannot find "insert" on this page: http://wiki.freepascal.org/Array I cannot find it here either: https://www.freepascal.org/docs-html/ref/refsu14.html For the last 10 years or so I've been criticizing occasionally the fact that everyone reinvents their own array algorithms for each array! So it seems that may solve it. In fact this problem goes back to the 1970's and 1980's when arrays were being used. Please list other functions other than insert that are available? Maybe someone add it to the wiki/docs ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal AFAIK, that is avaible only in the trunk version of FPC. You need to build the trunk version of the documents by yourself. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal