Solved

Thread crashes

Posted on 2001-08-10
10
254 Views
Last Modified: 2010-04-06
Hi all

I have an application that communicates with a usb device.
The application has a send thread and a receive thread that work together.
The problem is that the receive thread crashes in the stress.
This happened to me in the past when I had an application whet worked with a high baud rate communication device (PCMCIA).
The receive thread works in a high priorety.
Any help will be appreciated.
0
Comment
Question by:Tal_avidor
10 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6372241
Off topic: Do you have my HID component? If not contact me.
robert_marquardt@gmx.de
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6372273
What kind of crash is it? Could you show us the code where it crashes and the exact exception message?

Regards, Madshi.
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 6372280
Madshi is right, the information provided is unsufficient to provide a reliable suggestion or even answer.

Usually, when multithreading problems occur, it's because of unsynchronized access to any kind of ressource which is not thread-safe itself.
0
 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6372337
What dou you use for connecting the Net? Some component, I guess? Which one?

Do your "sender" and "receiver" share the same information? How they interact with the visual side if the program (if any)? Delphi VCL is not thread-safe, you know...

Rgds,
Yavor
0
 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6372343
One more important question. Do you use synchronious (blocking) connection or asynchronious (non-blocking)?

Rgds,
Frodo
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6372375
Hehe... Yavor, Frodo... always me :)
0
 

Expert Comment

by:comptebidon81
ID: 6372601
If I understand right, your receive thread is sometime too slow and cannot receive all of the information? Do you have some kind of long processing with the datas that would slow the reception?

If so, (and if not already done) you could try to Post the information as soon as received and process it only when you have enough time.  (or use the same thread executed numerous times for each "bag" of info)

I guess the overall speed of the process will decrease a little, but your thread will not be overflowed anymore.

GunDamn
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6372923
Data not read from USB fast enough is simply overwritten by the new data. There is a small queue in the driver.
The other problem with USB is that you can get Windows lockups as long as 90 msecs where the USB is not served.
0
 
LVL 1

Author Comment

by:Tal_avidor
ID: 6373985
1) robert_marquardt can u tell me more abute this  "windows lockups".

2) comptebidon81 " you could try to Post the information as soon as received and process
it only when you have enough time".
this is what i did and it now the Thread is stabel.

I don?t use any component to work with usb.
I coded the devices firmware and driver my self.
And the application in Delphi is suppose to test the device. I will probably give comptebidon81 the points but I will not close this q I still need to test the thread a more.


0
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 300 total points
ID: 6375069
Windows simply gives higher priority to other parts of the OS so the USB is sometimes simply not served. That is tha bad architecture of Windows.
You should definitely go to
http://www.usb.org/forums/developers/webboard.html
There all USB developers meet to discuss their problems.

Please give me your email address and i will send me my HID component written in Delphi.
No problem with the point assignment. I do not hunt for points.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now