Re: Dealing with HANDLEs
- From: "Le Chaud Lapin" <jaibuduvin@xxxxxxxxx>
- Date: 1 Dec 2006 11:56:21 -0800
adebaene@xxxxxxxxxxxxxxxx wrote:
I agree, the problem is not a technical one : It is perfectly ok to use
DuplicateHandle as long as you play along the rules, but that's not the
point...
The problem I noticed is about object model : It's just rather
unnatural that a "Process" class is copyable. If there were such a
class, I would expect than, when an instance is duplicated, a new
process is launched (forked) on the system, and I doublt that is what
the OP wants
"Process" is just an identity object, who shouldn't be copyable for
semantic reasons ; as Jake as said, if you need to put them in an STL
collection, use (smart)pointers.
Salut,
I have to agree with you on the principle of natural conception. I did
look back and see that he is working with processes.
The technique Jake and I were proposing works for other kernel-mode
objects like mutexes, semaphore, etc. As for processes (and thread),
you're correct - there are some semantic issues that cannot be
overlooked. In particular, once you start controlling the underlying
mechanism (pausing, etc.) then there are other issues.
But...if you are working with other synchronization objects like
events, etc... then the C++ copy/assignment framework using
DuplicateHandle works well.
-Le Chaud Lapin-
.
- Follow-Ups:
- Re: Dealing with HANDLEs
- From: Ben Menashe
- Re: Dealing with HANDLEs
- References:
- Dealing with HANDLEs
- From: Ben Menashe
- Re: Dealing with HANDLEs
- From: Arnaud Debaene
- Re: Dealing with HANDLEs
- From: Pavel Lebedinsky [MSFT]
- Re: Dealing with HANDLEs
- From: adebaene
- Re: Dealing with HANDLEs
- From: Jake Forson
- Re: Dealing with HANDLEs
- From: Le Chaud Lapin
- Re: Dealing with HANDLEs
- From: adebaene
- Dealing with HANDLEs
- Prev by Date: Re: Dealing with HANDLEs
- Next by Date: Re: Dealing with HANDLEs
- Previous by thread: Re: Dealing with HANDLEs
- Next by thread: Re: Dealing with HANDLEs
- Index(es):
Relevant Pages
|
Loading