Solved

Thread crashes

Posted on 2001-08-10
10
270 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

829 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