[fpc-pascal] Getting the state of a TRTLCriticalSection
Is there a preferred way of reading back whether something (including the current thread) has already entered a TCriticalSection? I'm trying to put assertions in code that, partly under non-GUI thread control via Synchronize, adds and deletes pages to a TPageControl. If I do this property BloodyGreatLock: boolean read GetBGL write SetBGL; .. fBGL: TCriticalSection; .. function GetBGL: boolean; var gotLock: boolean; begin try gotLock := fBGL.TryEnter finally if gotLock then fBGL.Leave end; result := not gotLock end { GetBGL } ; then this initialisation code and test sequence initialization fBGL := TCriticalSection.Create; Assert(BloodyGreatLock = false); (* Check lock read works properly *) Assert(BloodyGreatLock = false); BloodyGreatLock := true; Assert(BloodyGreatLock = true); <= FAILURE HERE Assert(BloodyGreatLock = true); fails where indicated since the lock is owned by the current thread so TryEnter has succeeded. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Helpers: Implementation Location influencing the result
On 06.10.2013 01:46, Daniel Gaspary wrote: On Sat, Oct 5, 2013 at 8:27 PM, Sven Barth wrote: At location A the helper is not yet declared, thus GetAnotherString uses the GetString function of its own class. On location B the helper is already declared and thus the implementation of GetAnotherString will pick up the helper's GetString function instead. I believed that the location that matters, in this case, was only the object instantiation (program/implementation body), because it was, in both cases, after the helper declaration. A little weird. No. Whenever you call a method (either inside a class using (implicit) Self or outside using a variable) the compiler checks whether a helper for that type is in scope and uses that if it is. It has nothing to do with object instantiation (that would be more for Traits/Mixins: http://en.wikipedia.org/wiki/Trait_%28computer_programming%29 ). Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] is it possible to subclass a generic class?
I want to do something like this but the compile complains. Type generic TMyMap =class( generic TFPGMap) destructor Destroy; override; constructor Create; end; I want to override some methods and destructor before my class is specialized later. Is it possible? How? Dennis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: is it possible to subclass a generic class?
generic TMyMap = class(specialize TFPGMap) -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/is-it-possible-to-subclass-a-generic-class-tp5717022p5717023.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to stop a HttpApp via request?
On Sat, 5 Oct 2013, silvioprog wrote: 2013/9/25 Michael Van Canneyt On Wed, 25 Sep 2013, silvioprog wrote: 2013/9/24 Graeme Geldenhuys On 24/09/13 10:46, Michael Van Canneyt wrote: > > I am working on it. Thanks Michael. btw: The fcl-web (and all your guidance) has worked wonders with my client side CGI application. The organisation of code and application flow is so much better. Thanks again for all your patience and help. I had a look at http://bugs.freepascal.org/view.php?id=24810 And applied the patches there, with some extra modifications. I tested, and the server can now reliably be stopped without problems both in threaded or non threaded mode, from inside or outside a request. Michael. Worked like a charm. Thank you very much Michael! (y) What does (y) mean ? Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to stop a HttpApp via request?
Thumbs up. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Getting the state of a TRTLCriticalSection
On Sun, 6 Oct 2013, Mark Morgan Lloyd wrote: Is there a preferred way of reading back whether something (including the current thread) has already entered a TCriticalSection? To my knowlede this does not exist. The Microsoft implementation of a critical section has TryEnterCriticalSection, but I do not know how portable or useful that is. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
OT: (y) WAS: [fpc-pascal] How to stop a HttpApp via request?
>> >> Worked like a charm. Thank you very much Michael! (y) > > > What does (y) mean ? LOL I was puzzled too. And found a "funny" topic in Yahoo Answers :-o But in the end found it's a shortcut for Thumbs Up in Microsoft Messenger. -Flávio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: build a compiler for GO32v2 under Windows 8 (or 7)
it compiles and links ... still a lot of stuff to write and a bunch to adjust first tests ... first suprises!!! but it compiles and runs ... till the fisrt bug during first steps ... Philippe On Sat, 5 Oct 2013 22:48:09 +0200, Tomas Hajny wrote: > On Sat, October 5, 2013 21:34, Philippe wrote: > >> I am back !!! (a bit sick ... teeth ...) I am now trying to move to win32. At first leaving crt unit, moving to video unit. Problem!(?) ... I was using window, gotoxy and so on ... and I don´t find anything similar with video unit! > > First of all, what do you try to solve by moving from unit Crt to unit > Video? I suggested using unit video as a substitution of your original > direct access to video adapter memory. Partial alternative of GotoXY > exists in unit Video - there is SetCursorPos. However, there is no direct > support for Window and thus the addressing is in absolute coordinates, not > relative to the defined window. Using direct video memory access (i.e. > very low-level approach) together with high-level routines like Window, > etc., is a bit strange. Units Video and Crt are not very compatible to > each other at the moment, unfortunately (although the incompatibility may > not be as bad on Win32 as on some other platforms). Nevertheless, you may > try it. Otherwise, you'd need either to create your own alternatives of > Window, etc., based on unit Video, or to avoid using the solution based on > directly addressing video memory/buffer. > > Tomas > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org [1] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal [2] Links: -- [1] mailto:fpc-pascal@lists.freepascal.org [2] http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: OT: (y) WAS: [fpc-pascal] How to stop a HttpApp via request?
On Sun, 6 Oct 2013, Flávio Etrusco wrote: Worked like a charm. Thank you very much Michael! (y) What does (y) mean ? LOL I was puzzled too. And found a "funny" topic in Yahoo Answers :-o But in the end found it's a shortcut for Thumbs Up in Microsoft Messenger. Well, it clearly shows my age :) Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Getting the state of a TRTLCriticalSection
Michael Van Canneyt wrote: On Sun, 6 Oct 2013, Mark Morgan Lloyd wrote: Is there a preferred way of reading back whether something (including the current thread) has already entered a TCriticalSection? To my knowlede this does not exist. The Microsoft implementation of a critical section has TryEnterCriticalSection, but I do not know how portable or useful that is. I think that one's generally available, but it looks as though it does the same as TCriticalSection.TryEnter. In the end I stuck in code to increment/decrement a counter, and looked for it to be explicitly 0 or 1. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Helpers: Implementation Location influencing the result
On Sun, Oct 6, 2013 at 8:09 AM, Sven Barth wrote: > No. Whenever you call a method (either inside a class using (implicit) Self > or outside using a variable) the compiler checks whether a helper for that > type is in scope and uses that if it is. It has nothing to do with object > instantiation (that would be more for Traits/Mixins: > http://en.wikipedia.org/wiki/Trait_%28computer_programming%29 ). Thank you, Sven. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Getting the state of a TRTLCriticalSection
On Sun, 6 Oct 2013, Mark Morgan Lloyd wrote: Michael Van Canneyt wrote: On Sun, 6 Oct 2013, Mark Morgan Lloyd wrote: Is there a preferred way of reading back whether something (including the current thread) has already entered a TCriticalSection? To my knowlede this does not exist. The Microsoft implementation of a critical section has TryEnterCriticalSection, but I do not know how portable or useful that is. I think that one's generally available, but it looks as though it does the same as TCriticalSection.TryEnter. Yes, but it is different from EnterCriticalSection, which makes it more suitable for testing. Anyway, glad you found an alternative. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Getting the state of a TRTLCriticalSection
In the end I stuck in code to increment/decrement a counter, and looked for it to be explicitly 0 or 1. Do you need to put a memory barrier around that, or does the critical section take care of that? On 10/06/2013 06:55 PM, Mark Morgan Lloyd wrote: Michael Van Canneyt wrote: On Sun, 6 Oct 2013, Mark Morgan Lloyd wrote: Is there a preferred way of reading back whether something (including the current thread) has already entered a TCriticalSection? To my knowlede this does not exist. The Microsoft implementation of a critical section has TryEnterCriticalSection, but I do not know how portable or useful that is. I think that one's generally available, but it looks as though it does the same as TCriticalSection.TryEnter. In the end I stuck in code to increment/decrement a counter, and looked for it to be explicitly 0 or 1. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: OT: (y) WAS: [fpc-pascal] How to stop a HttpApp via request?
Am 06.10.2013 18:44 schrieb "Michael Van Canneyt" : > > > > On Sun, 6 Oct 2013, Flávio Etrusco wrote: > Worked like a charm. Thank you very much Michael! (y) >>> >>> >>> >>> What does (y) mean ? >> >> >> LOL I was puzzled too. And found a "funny" topic in Yahoo Answers :-o >> But in the end found it's a shortcut for Thumbs Up in Microsoft Messenger. > > > Well, it clearly shows my age :) I don't think that has something to do with age. I didn't know it either. But then I don't use Microsoft Messenger... Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] DOS compiler wiki page: please review
On 10/05/2013 03:07 PM, greim wrote: Hi, writing a 8086 version of fpc is not so strange as some may think! There are still some 80186 processors around running in embedded systems! These architecture is certified for some applications in industrial and avionik controll. So my wish list: fpc for 80186, supporting the new extended addressing and writing the header files for RTOS (see http://www.beck-ipc.com/en/products/rtos/index.asp) incl. a FPU emulation ! From what I read from the links you posted, the extended addressing seems to be just like the regular real mode, except that segments are spaced not 16, but 256 bytes apart, is that correct? If that's the case, it should be easy to support - it's just a matter of writing the RTL for the new OS and using the appropriate linker. FPC for i8086 produces object files in the standard ROMF file format, they just use the extension .o, instead of .obj. Note that FPC currently only supports the tiny, small and medium memory models. Compact, large and huge are planned, but not started yet. But you can try writing an RTL for RTOS with the current memory models. In principle, it shouldn't be any harder than porting the compiler to any new OS, where the CPU is already supported. And when I implement the compact/large/huge memory models, the RTOS RTL will have to be adapted to support them. Most likely, the far heap manager (which doesn't exist yet) will have to be adapted to support the different spacing between the segments. As for FPU emulation, it is also on my TODO list :) Nikolay ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: OT: (y) WAS: [fpc-pascal] How to stop a HttpApp via request?
Hehehe... (y) is "like" emoticon in Facebook ( http://jess3.com/media/projects/246/JESS3_Case_Study_JESS3_Labs_FB_Emoticon_Guide_Snackable-1.jpg). :) (y) -- Silvio Clécio My public projects - github.com/silvioprog ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal