|
vikrams wrote: Now Is there any system timout I can configure for the same?
Why?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The question raised here due to the following scenario
1) I have filer where data is stored
2) I Copy data from this filer share to my local machine
3) When I try to copy a file, Filer goes for Antivirus scanning for it
Note: This scanning time varies depends upon file size and complexity
4) Mean time My copy operation waits and evently timeouts in some cases
Now I want to know this timeout value.
|
|
|
|
|
Ok, is it failing when copied via Windows itself (e.g., Explorer), or from within your code?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Failing form windows side only.
|
|
|
|
|
Well, if Windows is not accounting for such a failure, I'm not sure what you can do about it.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The function readch() reads a character. But what do I use to "read a character, but do not wait for him to type a character?" How can the program find if there is a character waiting in the standard-input buffer?
|
|
|
|
|
|
*?#! You were faster.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
|
This one [^] looks promising.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hello everyone,
Suppose I have a component (class) CX implements IUnknown interface, and I have retrieved a pointer of CX by IUnknown pointer (IUnknown*), that is.
IUnknown* pCX;
QueryInterface (IID_IUnknown, &pCX);
delete pCX;
Even if I declare the component CX's destructor as virtual, if I delete through IUnknown pointer to "release" the object, there is still potential memory and resource leak, because in IUnknown interface, destructor is the compiler provided default one, which is non-virtual and public, right?
thanks in advance,
George
|
|
|
|
|
NEVER do that. COM has its own mechanism to perform cleanup, you must not break the toy.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks CPallini,
I should ask the question in another way. Is the default destructor virtual or not?
regards,
George
|
|
|
|
|
Default destructor is not virtual.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks CPallini,
Question answered.
regards,
George
|
|
|
|
|
George_George wrote: because in IUnknown interface, destructor is the compiler provided default one, which is non-virtual and public, right?
yes, But why don't you use Release() that's the COM needs.
|
|
|
|
|
Thanks Rajkumar,
I should ask the question in another way. The default destructor is non-virtual and public, right?
regards,
George
|
|
|
|
|
George_George wrote: The default destructor is non-virtual and public, right?
and your previous one
"destructor is the compiler provided default one, which is non-virtual and public, right?"
George_George wrote: I should ask the question in another way
I can understand that the above two has no difference, you can try something different that shows the difference of your question.
|
|
|
|
|
Thanks Rajkumar,
Sorry English is not my native language. I think you have answered my question, the default destructor is not virtual and it is public, right?
regards,
George
|
|
|
|
|
George_George wrote: I think you have answered my question
yes.
|
|
|
|
|
Thanks Rajkumar,
Question answered.
regards,
George
|
|
|
|
|
George_George wrote: if I delete through IUnknown pointer to "release" the object, there is still potential memory and resource leak, because in IUnknown interface, destructor is the compiler provided default one, which is non-virtual and public, right?
Right, except that strictly speaking you get "undefined behavior" which may or may not be a memory leak (with VC++, I bet it is a memory leak).
|
|
|
|
|
Thanks Nemanja,
Question answered.
regards,
George
|
|
|
|
|
The correct way is:
<br />
IUnknown* pCX;<br />
HRESULT hr = QueryInterface (IID_IUnknown, &pCX);<br />
if (!FAILED(hr))<br />
{<br />
pCX->Release();<br />
}<br />
delete cannot achive many of what COM interfaces are about:
reference counting:
Many clients might use the same object. You must not delete it before everyone else is done with it.
Use Release() to indicate "I am done with the object". The object will delete itself when it is no longer needed.
language independence
The object bight be implemented in VB, or Delphi, or one of many other languages. delete cannot correctly release an object that is implemented in another language.
Even if the object was implemented in C++, delete is likely to fail: a virtual destructor helps only when the object was allocated by the same memory manager.
location independence
COM allows to use objects in a separate process or even on another computer without really knowing about it. How is C++' delete going to delete an object on a server in hawaii? Some such relocations may be activated by registry configuration, independent of your code.
You need to follow the Reference Counting Rules[^] of COM.
Using smart pointers make that somewhat easier.
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist
|
|
|
|
|
Thanks peterchen,
Comprehensive reply.
regards,
George
|
|
|
|