-
Content Count
2268 -
Joined
-
Last visited
-
Days Won
46
Everything posted by Fr0sT.Brutal
-
Maybe using new Inno versions will help?
-
Removal of startup Plug-In in Delphi Rio
Fr0sT.Brutal replied to bazzer747's topic in Tips / Blogs / Tutorials / Videos
Interesting option but the usage of BOM makes it almost useless -
Freezing UI in a software that costs ~$1k *facepalm*
-
Don't bother, you explained it pretty clear but 2 bytes could easily cross 32bit boundary couldn't they?
-
Yes, and I see that w2 field is not aligned. And it is 2 bytes long so, AFAIU, potentially prone to non-atomic change. Well, Pawel's experiment shows that in some cases they won't. Moreover, alignment lesser than 32 could be forced by project options. If you ship a library unit that gets recompiled along with 3rd party's project, you'll have to explicitly specify alignment to avoid access collisions.
-
Regarding the strings - assignment is performed in these steps: ( Initially we have string S1 that is pointer P1 pointing to memory M1 and assigning to it string S2 that is pointer P2 pointing to memory M2 ) 1) ref count of S2 is interlocked-incremented 2) P1 is saved to Ptmp 3) value of P1 is replaced with value of P2 4) ref count of string that Ptmp points to is interlocked-decremented 5) if new ref count is 0, M1 is deallocated All these steps are not performed as single atomic operation so could be interrupted by another thread. So, if another thread is reading, it could interfere in any place between and even inside these steps. For example: 0) Initially Thr1 has string field that Thr2 reads and holds the copy in its internal variable so the field has ref count 2 1) Thr1 assigns new value to its field, thus decrements ref-count, new ref-count is 1 2) Thr2 reads new value from Thr1's field thus decrements ref-count, new ref-count is 0 3) Thr1 checks if ref-count is 0 - true 4) Thr2 checks if ref-count is 0 - true 5) Thr1 deallocates memory 6) Thr2 deallocates memory - KABOOM!
-
It's a rare case for variables that are accessed from several threads to be independent. Usually they are fields of a structure/object/class so nothing could guarantee they're aligned without explicit measures. So you'll have to either ensure alignment (by using paddings, dummy fields, $A directives etc) or just accept that accessing variables of size more than 1 byte is probably not atomic. Thanks for clarification, I missed the influence of data bus.
-
Hm, what if a variable isn't aligned? It produces single mov instruction anyway. Or do you mean that CPU will have to do several instructions to modify that variable? If that is true, seems no simple variable or member could be safely accessed without locks, at least until a code aligns it at runtime explicitly
-
Sourcetrail support for Delphi
Fr0sT.Brutal replied to Jacek Laskowski's topic in Delphi IDE and APIs
Yes but now it's more like "Idera as Embarcadero" typecast -
Sourcetrail support for Delphi
Fr0sT.Brutal replied to Jacek Laskowski's topic in Delphi IDE and APIs
Offtopic: I think we should create some short macro that would mean "whatever company that owns Delphi at the moment" -
Not so high actually at least to have it working at a simplest level.
-
how get results back from a low level task?
Fr0sT.Brutal replied to jus's topic in OmniThreadLibrary
PostMessage from bg thread to main form with LParam=your-generated-bitmap -
is there any "currency to words" routine for Delphi?
Fr0sT.Brutal replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
© JK Rowling, HP & Philosopher's stone. That's all what should be said about English measure system 😄 -
Cross-platform solution to forcefully end a thread
Fr0sT.Brutal replied to aehimself's topic in Cross-platform
I wonder what SQLite guys suggest to use instead of threads. Maybe they'll say "Use DB queries in the very main thread, and if you have queries lasting longer than 200 ms, do not use DB"? 😄 -
is there any "currency to words" routine for Delphi?
Fr0sT.Brutal replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
Russian also has legacy naming of 11..19: 11 is odinnadzat = odin-na-desyat = one-and-ten while numbers above 20 are usual "most significant digit first" like 21 is dvadzat odin = twenty one. And all numers that are multiple of 10 are named in the same logical manner like 30 is tridzat = tri-desyat = three tens except 40 which is just weird "sorok". Well, even the strict and logical English has 11 and 12 with their own personal names, maybe it's a legacy of 12-al system? -
Creating an array of controls in Delphi
Fr0sT.Brutal replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
In some places I use such constructions for ctrl in TArray<TControl>.Create(Button1, Checkbox1, Memo1) do ctrl.Enabled := True; -
Cross-platform solution to forcefully end a thread
Fr0sT.Brutal replied to aehimself's topic in Cross-platform
With all the respect to professor and so on, marking threads the absolute evil rather looks like being unable to use them right. There's no other means of doing several things at one time. All the async sugar is implemented via threads under-the-hood. Processes? Highly similar to threads. Some languages strive to hide this mechanism from a programmer, just like Go and JS. But they use threads internally anyway. I suspect pr. Lee doesn't suggest any acceptable alternative? -
How to compare msXML nodes
Fr0sT.Brutal replied to Tommi Prami's topic in RTL and Delphi Object Pascal
My idea was: - you have your XML loaded - you loop through nodes and number them with unique ID's - now you can easily identify the nodes returned by FindNode - when it's time to save XML, first clean these temporary ID's but now when you mention two processes, I got lost and can't realize what exactly you want. Maybe if you could describe your task in brief but fully it'll shed some light. -
You can rename/remove refactoride###.bpl file
-
Vincent, I can understand multiple dproj, but there are multiple dpr-s!
-
Cross-platform solution to forcefully end a thread
Fr0sT.Brutal replied to aehimself's topic in Cross-platform
What if CallStuffThatMightBlockForever never returns? -
@Vincent Parrett lol now when you mentioned a console project I noticed the bunch of DUnitXTest_*.dpr files :D. I've really overlooked them thinking it's just packages or similar. Is it really necessary having a specific project file for each compiler version?
-
How to manage defined list values
Fr0sT.Brutal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Yup, my mistake. Codeinsight doesn't show arrays, even constant ones. -
You can start from examining available OTA interfaces for necessary events and methods. Anyway the code editor is just a Windows' window (heh) so it probably supports standard WM_*/EM_* messages
-
is there any "currency to words" routine for Delphi?
Fr0sT.Brutal replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
Huh, ICU lib contains pretty much more than 100 files and that is even not considering data, only the code! Of course ICU is global but proper int-tion isn't piece a cake O___O Wow, so weird! Didn't know that.