FredS
-
Content Count
408 -
Joined
-
Last visited
-
Days Won
4
Posts posted by FredS
-
-
23 minutes ago, Dave Nottage said:working in 64-bit
Works fine in Berlin+ Win64..
-
Defined in Winapi.ShlObj.
-
1 hour ago, David Hoyle said:{$IFNDEF DEBUG} around the inline directive
With include files one can change the inline option and skip all those IFNDEFs, tested with Berlin and up.
In this case the include file includes a CustomInclude.inc, which is part of the project. This makes it simple to edit in the IDE as required./// <remarks> /// NOTE: You can override this in CustomInclude.inc, but it requires a Build /// and won't update the Blue Dots /// </remarks> {$IFNDEF RELEASE} {-$INLINE OFF} // un-comment as needed {$ENDIF RELEASE}
- 2
- 2
-
3 hours ago, Ian Branch said:FindWindow(PChar('TMainForm'), nil);
You're banking on no other form using 'TMainForm' as a class name on the system?
I'd use Process Info instead, quick search gave me this: https://stackoverflow.com/questions/2616279/how-can-i-get-other-processes-information-with-delphi
-
12 minutes ago, ConstantGardener said:you could work without the TTaskAction
Yup, or for readability (10+ years later) add it as a last parameter with a default value.
- 1
-
5 hours ago, Mark- said:any keys without 'N'
Works here.. but that code should only run if 'IsWin8'
-
The line with 'isWin8' is required and correct and the line following with 'data[66]' should only be executed if isWin8=true.
-
2 hours ago, dummzeuch said:replying that these were false positives
Sure doesn't increases my confidence, what about False Negatives.. 🙂
-
2 hours ago, Dalija Prasnikar said:closed bug reports I made about LF issues
Changed that option then used Notepad++ to generate 4 lines with LF only, pasted into 10.3.3, saved and opened the file in Notepad++, LF still terminates two of the line endings.
File another bug report? 🙂
-
21 minutes ago, jbg said:Why?
I read that as 'why can't Andreas fix all their bugs' 🙂
- 1
-
57 minutes ago, Sherlock said:VM...reconsider
Or don't install EMB anything 'till your daily backup ran then recovery is a click away 🙂
-
19 hours ago, Phil J. said:nothing displays properly
10.3.3 breaks display when I RDP into the VM .. again (10.3.1 had this issue).
So badly that its not usable without IDE Fix Pack 6.4.4.
-
7 hours ago, Fr0sT.Brutal said:Usually they are fields of a structure/object/class so nothing could guarantee they're aligned
Default Align setting does that already. With that default (A+) the only way to get fields that do not conform is by by packing a record.
-
Yes, but you launch 20 threads.
My point was about a single write single read thread.3 hours ago, FredS said:For a Delphi string, it's never threadsafe if you have one thread writing and one thread reading.
But regardless my test also fails when increased to 10 million with single steps..- 1
-
@Attila Kovacs Doubt that is possible, I imagine that you need to prep your new string in a function then write it out.
-
12 minutes ago, Attila Kovacs said:Does it changes the length of the string?
Yes, ends with "One Million Two Thousand and 34/100"
- 1
-
1 hour ago, Pawel Piotrowski said:NOT thread Safe
Been on the back of my mind since I read Marco's book but I never had to deal with strings where a lock wasn't used.
However, if the main thread (mt) only reads and a worker thread (wt) only writes this should be fine.
The way I see this is that when the wt writes to a string variable if first makes a reference copy of the original. If the mt reads that string it gets the old value while its being written to.
Once the write lock is off the string var now points to the new string and when the mt tries to read it the next time around it gets a reference to that string.A quick test is below, I used a Cursive Number method to make the string more complex for the test
, I know a version of that is available here somewhere.
Unfortunately the version available does not reverse from Text. But you can simply replace these three calls with CurrToStr/StrToCurr.Guess I could let that run a bit longer and see if there are any collisions..
//MMWIN:MEMBERSCOPY unit _MM_Copy_Buffer_; interface type THelperTests = class(TObject) public [Test] [TestCase('10k', '10000')] procedure TestStringThreadSafe(Iterations: Integer); end; implementation procedure THelperTests.TestStringThreadSafe(Iterations: Integer); var c, LastReadC : Currency; s : string; HasTerminated : Boolean; i : integer; const IncBy = 1000; begin // Assert.IsTrue(TAtomic.IsNatural(c, SizeOf(c)), 'Currency will only work in x64'); c := 1000.34; s := TCursiveNumbers.ToText(c); {- Reading } TThread.CreateAnonymousThread( procedure var rS : string; CurrentC : Currency; begin LastReadC := c; rS := s; while not HasTerminated do if rS <> S then begin rS := S; CurrentC := TCursiveNumbers.ToCurrency(rS); Assert.AreEqual(LastReadC + IncBy, CurrentC, 'Oops'); LastReadC := CurrentC; end; end).Start; for i := 0 to Iterations do begin c := c + IncBy; s := TCursiveNumbers.ToText(c); Sleep(1); // give the slice away end; HasTerminated := True; Sleep(2); Assert.AreEqual(c, LastReadC, 'Reading does not match writing'); Log(S); end; end.
-
14 minutes ago, Pawel Piotrowski said:For a Delphi string, it's never threadsafe if you have one thread writing and one thread reading.
Was that a typo?
-
15 minutes ago, Dalija Prasnikar said:Debugging in Rio is much worse than in Tokyo.
And Tokyo was much worse than Berlin 🙂
-
7 hours ago, dummzeuch said:What about a packed record
OK, simple variables and lets add default aligned, but that was not the question.
As you can see with the TSrwLock declaration, the FIRST variable in a record is always properly aligned.
I use this during initialization:
//MMWIN:MEMBERSCOPY unit _MM_Copy_Buffer_; interface type TAtomic = record /// <summary> /// Assures {$A8} or {$A+} state /// </summary> /// <seealso href="https://stackoverflow.com/questions/829235/ifopt-a4"> /// {$IFOPT A4}? /// </seealso> class constructor Create; end; implementation { TAtomic } class constructor TAtomic.Create; type TTestRec = record A: Byte; B: Int64; end; begin // In the {$A8} or {$A+} state, fields in record types that are declared without the packed modifier and fields in class structures are aligned on quadword boundaries. {$IF SIZEOF(TTestRec) <> 16} 'App must be compiled in A8 mode' {$IFEND} end; end.
-
50 minutes ago, ertank said:Do I still need to do such protection
Variables SizeOf Pointer or below is always atomic.
Atomic means access to a full variable in one read/write.
-
1 minute ago, Uwe Raabe said:Perhaps the ISO installer requires
I checked for installation instructions and found none, attempted an install and failed.
Enough new EMB tech for now.. 🙂
BTW: Its difficult to compare previous installers since they change (and fail) frequently but in the last few ISO versions it prompted for an uninstall before installing.
Will see how that goes on my laptop later, its setup using 'Web Installer'..
- 1
-
-
2 hours ago, Remy Lebeau said:Your code is not differentiating between
Which should not be required for a single privilege.
- 1
SHOpenFolderAndSelectItems 64-bit
in Windows API
Posted
shell32 is declared in Winapi.ShlObj in the implementation section.
You in Berlin or UP, or something else?
You know asking Qs without supplying sufficient information simply leads to what you see here..