Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Clarion in general: Copying data from string to cstring without triggering non-thread safe RTL calls 2002-12-17 -- Andy Ireland Newsgroups: comp.lang.clarion
Hi Gordon,
> Clarion code can be thread safe (Andy will correct me on this, as there are
> some special cases - like NEW...), but the runtime is not. This problem is
> amplified as the runtime is used quite heavily in the automatic type
> conversions....
Correct!. The keys to thread safe coding are....
a.) overide the clarion memory functions
b.) make all groups ',auto' then clear using ZeroMemory() API
c.) overide Cla$StoreCStr which allows cstring <<-- const assignments
d.) avoid using unsigned types and multiplication / division. Multiply and
divide where possible using bshift
e.) use ref vars to Interfaces and classes and pass everything by address
f.) execute unsafe code in the accept loop, not in a subclass or pre-emptive
thread
g.) replace clarions queue support with STL maps exported from a C++ DLL
h.) export VC++'s C RTL functions that are needed as above for strlen etc
This is why the OLE classes in FileExplorer are thread safe. 90% of clarion
code is easy to make safe. The rest we created PlugIT for. The stack
functions do not need to be overidden, but merely code that calls into them,
avoided.
Regards
Andy
Plugware Solutions.com Ltd, taking the puzzle out of I.T
Tel : +44 1249 813335
Fax : +44 1249 813462
Today is November 21, 2024, 7:28 am This article has been viewed 35219 times. Google search has resulted in 91 hits on this article since January 25, 2004.
|
|