> I assume the "bug" you're implying is the bug of corrupting a file by
> writes from multiple threads, yes?
Yes, that's just one sample.
> Otherwise I'm
> confused - is it OK to share handles, or not (regardless of whether it
> would be stupid to try it)?
See, it's no problem in itself to share a handle. It can cause problems if
you do things to it simoultaneously, however. For example, if 3 threads
want to append data to a file in the same time, it's highly likely that the
file gets corrupted, but if the same three ensure that when one of them is
using the handle, the other two wait for its completion, then nothing will
go wrong.
> Goodness yes. I was actually thinking the other way round - the app
> using, say, CreateFile() to open a file, and passing the handle to
> delegate the actual writing to the OCX for some contrived reason. I
> just want to understand the mechanics of it, even if the semantics say
> it is foolish to use it in that manner for the situation.
That would cause no problem, since your thread #1 forgets about the handle
once it has moved it to your thread #2.
> Yes, but I am using "OCX" to refer to a unit of code that is known as
> ActiveX one day and OLE Control another day, etc.
> {;v) - it's clearly not quite the same as a DLL, but also not a proper
> automation server (as an EXE). Specifically, I'm talking about
> controls created mostly with VB in mind (love it or hate it) although
> of course VC can use them.
Actually, COM objects can be implemented in both DLLs and EXEs just fine.
The threading model specifies how the object gets initialized in the
runtime.
As far as OCXs are concerned, they're *no* different to DLLs, and it's not
necessary for them to host COM objects always. I know that you use this
name to refer to ActiveX control modules, but it's more appropriate to use
the term DLL (because it's after all a PE DLL) and also the OCX name might
not be familiar to VC developers who have not come across them. I'm not
going to attack VB here, only I think using the correct name (ActiveX) pays
off by ensuring more prople precisely understand what you're talking about.
But I'll personally be fine whether you call them OCXs or ActiveX DLLs, or
anything else for that matter! ;-)
-------------
Ehsan Akhgari
Farda Technology (http://www.farda-tech.com/)
List Owner: [email protected]
[ Email: [EMAIL PROTECTED] ]
[ WWW: http://www.beginthread.com/Ehsan ]
Such persons vaunt about not lying: but inability to lie is still far from
being love to truth.
-Thus Spoke Zarathustra, F. W. Nietzsche
_______________________________________________
msvc mailing list
[email protected]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for
subscription changes, and list archive.