Solved

Thread crashes

Posted on 2001-08-10
10
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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