[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Sc-devel] Fwd: SF.net SVN: supercollider: [6649] trunk/Source/lang/LangPrimSource/ PyrSerialPrim.cpp



Begin forwarded message:
From: kersten@xxxxxxxxxxxxxxxxxxxxx
Date: 19. November 2007 10:52:30 GMT+01:00
To: sc-dev@xxxxxxxxxxxxxxx
Subject: SF.net SVN: supercollider: [6649] trunk/Source/lang/ LangPrimSource/ PyrSerialPrim.cpp


Revision: 6649
          http://svn.sourceforge.net/supercollider/?rev=6649&view=rev
Author:   kersten
Date:     2007-11-19 01:52:29 -0800 (Mon, 19 Nov 2007)

Log Message:
-----------
fix read(2) return value handling in SerialPort::threadLoop()

Modified Paths:
--------------
    trunk/Source/lang/LangPrimSource/PyrSerialPrim.cpp

Modified: trunk/Source/lang/LangPrimSource/PyrSerialPrim.cpp
===================================================================
--- trunk/Source/lang/LangPrimSource/PyrSerialPrim.cpp 2007-11-18 22:53:37 UTC (rev 6648) +++ trunk/Source/lang/LangPrimSource/PyrSerialPrim.cpp 2007-11-19 09:52:29 UTC (rev 6649)
@@ -100,6 +100,7 @@
SerialPort(PyrObject* obj, const char* serialport, const Options& options);
 	~SerialPort();

+	bool isRunning() const { return m_running; }
 	int fd() const { return m_fd; }
 	const Options& options() const { return m_options; }

@@ -370,11 +371,12 @@
 						}
 					}
 					nr += n;
-				} else if (n == -1) {
-					if (errno == EAGAIN) break;
-					else goto done;
+				} else if ((n == 0) || ((n == -1) && (errno == EAGAIN))) {
+					break;
 				} else {
-// 						printf("SerialPort HUP\n");
+#ifndef NDEBUG
+					printf("SerialPort HUP\n");
+#endif
 					goto done;
 				}
 			}
@@ -398,7 +400,10 @@
 	tcflush(fd, TCIOFLUSH);
 	tcsetattr(fd, TCSANOW, &m_oldtermio);
 	close(fd);
-// 	printf("SerialPort closed\n");
+	m_running = false;
+#ifndef NDEBUG
+	printf("SerialPort closed\n");
+#endif
 }

// =====================================================================


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.