views:

124

answers:

2

In our C# application we are making use of a thirdparty (Thesycon) COM object which runs threads to write data to a scanning device from 7 files.

I start the writing method by calling

COM.StartWriting()

and I can stop it by calling

COM.StopWriting()

Now the problem is I'm unable to synchronize the threads. This means out of 7 I always miss 4 files. If look in the Debug window, the worker thread type is shown as 'BackGround' and MTA. How do I synch my Main and Worker threads?

A: 

If the COM object provides no means to monitor its process, then the answer is going to be NO.

If the COM object does provide a mechanism, then you need to use that to determine when you can perform the StopWriting.

Richard
A: 

From what I can gather, the COM object is reading from seven files (why seven?) and writing to some device.

You control when it starts writing - that makes sense.

But you say you also control the time when it stops writing. It's writing the contents of seven files yet you can stop it whenever you want, with no idea how far it has progressed through the contents of the files? Why doesn't it stop when it has finished writing the content in the files?

That part doesn't make any sense.

And what do you mean when you say you "miss" four of the files?

Daniel Earwicker