Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If i use scm.writeBytes other threads always freeze #38

Open
makarna35 opened this issue Apr 1, 2019 · 0 comments
Open

If i use scm.writeBytes other threads always freeze #38

makarna35 opened this issue Apr 1, 2019 · 0 comments

Comments

@makarna35
Copy link

makarna35 commented Apr 1, 2019

If i use scm.writeBytes other threads always freeze

Example:

runProgressBar();
// WriteToPort
            Object[] openPort = openComPort(selectedComPort.getSelectedItem().toString());
            scm = (SerialComManager) openPort[0];
            handle = (long) openPort[1];
            try {
                // Write delayInbytes
                scm.writeBytes(handle, messagesData.getBytes(), speedSlider.getValue());
                //System.out.println("WRITE COMPLATE : ");
                //System.out.println("write : " + scm.writeString(handle, textSpeedSliderStringValue, 0));
                portRepeatingRead();
            } catch (Exception e) {
                e.printStackTrace();
            }

public void runProgressBar() {
    loadingBar.setVisible(true);
    loadingBar.setStringPainted(true);
    threadProgressBar = new Thread(new Runnable() {
        @Override
        public void run() {
            int i = 0; 
            try { 
            while (i <= 100) { 
                // fill the menu bar 
                loadingBar.setValue(i + 10); 
  
                // delay the thread 
                Thread.sleep(messagePercent1); 
                i += 1; 
            } 
        } 
        catch (Exception e) { 
        } 
        }
    });
    threadProgressBar.start();
}

//-------------------------------------------------------//
runProgressBar(); function start before scm. But always freeze. after finished write port loadingBar.setVisible(true); work. why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant