Hi,
I know that the System.IO.Ports.Serial port event for receiving data
(DataReceived) happens on a secondary thread, and that if there will be any
interaction of that data with the UI, it should be done through invoke.
Right now my application receives serial data and a class hierarchy is
responsible for handling it.
If I run the application, everything seems to work fine, but if I put a
breakpoint on it and try to follow, the weirdest things happen. For example,
sometimes it gives error messages, sometimes the application just stops
(vanishes is the correct word) and some other times VS IDE halts and
completely goes away. That usually happens if I put the mouse over any
variable and try to inspect its value.
For me it smells like threading problems (and if it smell like a duck and
walk like a duck...).
What is the best practice on handling the received data once it arrives (and
triggers the event) on the serial port? Do I have to synchronize it with the
main app thread?
Cheers
Padu 2 3451
If you have data that both are accessing yes you have to synchronize them.
Cheers,
Greg Young
"Padu" <pa**@merlotti.com> wrote in message
news:ze********************@iswest.net... Hi,
I know that the System.IO.Ports.Serial port event for receiving data (DataReceived) happens on a secondary thread, and that if there will be any interaction of that data with the UI, it should be done through invoke.
Right now my application receives serial data and a class hierarchy is responsible for handling it. If I run the application, everything seems to work fine, but if I put a breakpoint on it and try to follow, the weirdest things happen. For example, sometimes it gives error messages, sometimes the application just stops (vanishes is the correct word) and some other times VS IDE halts and completely goes away. That usually happens if I put the mouse over any variable and try to inspect its value.
For me it smells like threading problems (and if it smell like a duck and walk like a duck...).
What is the best practice on handling the received data once it arrives (and triggers the event) on the serial port? Do I have to synchronize it with the main app thread?
Cheers
Padu
"Greg Young" If you have data that both are accessing yes you have to synchronize them.
Cheers,
Greg Young
The think is that right now, no, there's no thread concurrency. The problem
only happens in the debugger, and it happens very uglyly. So I was wondering
if I'm doing things the correct way.
Cheers
Padu This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tom Van Ginneken |
last post by:
Hi,
I need to write binary data to a serial port. I am using this function:
#include <unistd.h>
ssize_t write(int fd, const void *buf, size_t count);
I am able to write a alpha-numeric...
|
by: kiran |
last post by:
Hi all,
I have a problem to communicate with serial port(COM3:). I am able to open
the handle but cannot send any data.
1. I connected my motoroala handset to PC through datacable.
2. I...
|
by: Frank |
last post by:
Hello,
how to get information about all serial ports in the PC?
I use the following code, but i got only the data of the FIRST serial port.
All other serial port information are not available...
|
by: wesolutki |
last post by:
Hi,
how to send data to other application by serial port? I want to have
two programs opened on one computer, one send and second recive data,
but using serial port.
Wesolutki :-)
|
by: Lou |
last post by:
I have a class that creates an instance of the seril Port.
Every thing works fine except whenever I receive data I cannot display the
recieved data. I get no errors but the recived data seems to...
|
by: Lou |
last post by:
I have a class that uses the serial port class
Private SerialPort as New SerialPort
When I receive the asyncronous serial port response it appears that data is
on a different thread than my...
|
by: Rich |
last post by:
Hello,
I am working on a python library for sending and receiving data from a Subaru's ECU (the fuel injection computer) via the OBD-II port and an OBD to USB cable, with the Subaru Select Monitor...
|
by: =?Utf-8?B?Q2hhcmxpZQ==?= |
last post by:
Hi,
This apparently is a common problem and I've yet to read a solution that
actually works for my specific situation.
I have a Zebra RW220 printer that I connect to via Bluetooth connection...
|
by: anu29dolly |
last post by:
Hello everyone...
I have written a program to write and read data from serial port....
I am able to write 80(in binary)..and is expecting 1B but i am uable to read it...
My code goes as...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |