Multithreading Exception

Document Imaging SDK,
Image SDK,
TIFF SDK,
Annotation SDK,
Cover Page Generator

Moderator: Technical Support Team

Multithreading Exception

Postby sujanakar » Sat May 27, 2006 1:40 am

Hi,

I am developing a Multithreaded Application for Scanning. In one Primary Thread I am scanning Images and saving them to collection. In Second Thread, I am doing Image processing on the scanned Image by taking it from Collection.

My Problem is the Primary thread is scanning Images, but in Secondary thread when I try to load it from temporary file or Collection, I am getting some Exceptions. The brief Code for this is given below:

Sub StartScan( )
BiTwain.Action = BITWAINLib.enumScanOperations.TWSTAT_BATCHSCAN
Dim thrd as Thread
Thrd=new Thread(AddressOf ProcessImage)
Thrs.Start()
End Sub

Sub BatchPageDone( )
BIDIBObj.SaveDIBInImageFormatExt("C:\Temp\” & TempCount & “.tif",
hDib, 1, BIDIBLib.enumFileFormats.imgffTiff, BIDIBLib.enumCompressionModes.imgcmCcittG4, BIDIBLib.enumFillOrderModes.imgfoNormal, False)
TempCollection.Add(("C:\Temp\” & TempCount & “.tif")
End Sub

Sub ProcessImage( )
While TempCollection.Count = 0
Thread.CurrentThread.Sleep(100)
End While

Hdib=BITiffobj.LoadTiffIntoDIB(TempCollection.Item(0).ToString(), 0, False)

‘Processing HDib
End Sub

When the Secondary thread try to Load the Image from file, I am getting two errors. While trying to load First time, the Exception is “Request Timed out”. When try to load second time, the exception is “Because this evaluation could cause side effects, it will not be executed until enabled by user.”

After encountering the above errors the primary thread is running but the second thread stop responding.

When I run my application as Single threaded application. Its working fine but there are some performance issues. It is scanning properly but taking much longer time to display them.

Please let me know How can I speed up my application and What could be the problem for above exceptions. Can we develop a Multi threaded application using Black ICE SDK.

Thanx,
Sujan
sujanakar
 
Posts: 3
Joined: Wed Feb 22, 2006 3:13 am

Re: Multithreading Exception

Postby Windbearok3 » Mon Apr 11, 2011 4:16 am

thx for post .....interesting
Windbearok3
 
Posts: 1
Joined: Sat Apr 09, 2011 5:30 am
Location: Inola


Return to Imaging Toolkits



Who is online

Users browsing this forum: No registered users and 1 guest

cron