473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

A second (critical) problem in C++/ClI

Hi again;

after the 'literal's problem in abstract sealed classes, today I realized
another problem. As you know, if you require a finalizer in your class the
compiler automatically implements the general dispose pattern to ease the
development. (You only implement the !classname and ~classname methods) So
far so good. But if you derive from the CriticalFinalizerObject class, you
must annotate all methods reachable from the finalizer with a
ReliabilityContract attribute. Otherwise the CLR cannot pre-JIT your
finalization code to ensure that no asynchronous exceptions are thrown
during a critical finalization.

Now the problem is that the compiler does not allow you to define your own
Finalize method and internally implements the classical Dispose(bool
disposing) idiom which calls your actual finalization code. What this means
is; you cannot apply a ReliabilityContact attribute to this compiler
generated Dispose method and therefore your finalization code can never be
"prepared" for critical finalizations. You loose all the reliability that
the CLR provides, you can never be sure that your finalization code will be
executed, and much more important your CriticalFinalizerObject derived class
can also affect other objects waiting for finalization.
public ref class XXX : CriticalFinalizerObject
{
protected:

// Compiler generated Dispose method

// [ReliabilityContract(Consistency::WillNotCorruptSta te, Cer::Success)]
!!! missing !!!
virtual void Dispose([MarshalAs(::U1)]bool disposing)
{
if (disposing)
{
this->~XXX();
}
else
{
try
{
this->!XXX();
}
finally
{
CriticalFinalizerObject->Finalize();
}
}
}
...
};
Feb 19 '07 #1
0 850

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

77
by: Charles Law | last post by:
Hi guys I have a time critical process, running on a worker thread. By "time critical", I mean that certain parts of the process must be completed in a specific time frame. The time when the...
4
by: Matik | last post by:
Hi, I have a small theoretical issue. I have one table, which is prettyu large. There is lot of evaluations running on this table, that's why, each process need to wait for another to be...
2
by: Xarky | last post by:
Hi, I am trying to learn Critical Sections. I have written a small program. Source code problem below. What the program is doing is disabling the CRTL-C signal in the critical section. My...
7
by: Piotrek Stachowicz | last post by:
Hi, I need to create the situation in my system, where no more critical sections can be initialized (win2000Server). I thought about creating a simple c# application and using the Monitor class....
3
by: Ashish Jindal | last post by:
Hi, How do I identify whether a service is "Critical" or not? Basically, I am writing a program to stop all non-critical service. AFAIK, the services can be found in...
6
by: piyushdabomb | last post by:
Hi All, Currently, I have a SQL query where I need to grab the SECOND latest date by group. COMPONENTID COMPLETIONDATE CBT_HAZCOM 02/26/2007 15:17:00 CBT_HAZCOM 07/31/2007 21:23:00 QS ...
2
by: piyushdabomb | last post by:
Hi All, Currently, I have a table with 2 columns COMPONENTID and COMPLETIONDATE COMPONENTID COMPLETIONDATE CBT_HAZCOM 02/26/2007 15:17:00 CBT_HAZCOM 07/31/2007 21:23:00 QS 02/12/2007...
4
by: not_a_commie | last post by:
I have a tight time constraint on a small chunk of processing. It takes about a third of a second to run. Occasionally, this function will get stalled for (what I can only guess) is a garbage...
5
by: =?Utf-8?B?VmFubmk=?= | last post by:
Hi, I have a component where I need to have thread-safe access to a list. Operations on the list are done in critical sections (lock (lockObject) { ... } ) in the usual way, to make sure that no...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.