nyholku / purejavacomm

Pure Java implementation of JavaComm SerialPort
http://www.sparetimelabs.com/purejavacomm/index.html
BSD 3-Clause "New" or "Revised" License
366 stars 146 forks source link

Run SerialPortEventListener in other Thread #102

Closed Tsyklop closed 7 years ago

Tsyklop commented 7 years ago

Hi.

Can your make run SerialPortEventListener in new thread?

Thanks.

nyholku commented 7 years ago

Please elaborate I do not understand what you want to do.

Tsyklop commented 7 years ago

@nyholku Now the SerialPortEventListener runs in one thread. I'm doing the Swing application and before I display the window I connect to usb, but because the SerialPortEventListener starts in the same thread, the whole process stops on the SerialPortEventListener and the program does not go any further.

Tsyklop commented 7 years ago

@nyholku for example librarry JSSC run Listener in new Thread and program run success.

nyholku commented 7 years ago

Hmm, not sure I still understand the problem. PJC creates an internal thread for each open port and the SerialPortEventListener gets called from that thread, so unless you block inside the SerialPortEventListener event handling everything should be ok. If you need to do Swing stuff from within the SerialPortEventListener you should use swing utilities invoke methods.

Tsyklop commented 7 years ago

I check again. Sorry. my mistake.