Solved

Thread crashes

Posted on 2001-08-10
10
274 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
Technology Partners: 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

Title # Comments Views Activity
Delphi: ForceDirectory plain function 7 84
enhance the following code 3 53
Problem working with dynamic array - help 2 48
Firemonkey how to swip panel with finger tap 1 40
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…

732 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