summaryrefslogtreecommitdiff
path: root/NxWidgets/libnxwidgets
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-11 00:05:25 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-11 00:05:25 +0000
commita280d993608d0c40ad0b4efc8adcbf72f67d53a4 (patch)
tree0c718467856492451acfb8af51db3d59abad08fb /NxWidgets/libnxwidgets
parent68f3044b5099572850a9e81a1c63161c20809547 (diff)
downloadnuttx-a280d993608d0c40ad0b4efc8adcbf72f67d53a4.tar.gz
nuttx-a280d993608d0c40ad0b4efc8adcbf72f67d53a4.tar.bz2
nuttx-a280d993608d0c40ad0b4efc8adcbf72f67d53a4.zip
NxWM: Finishes touchscreen implementation; NuttX: Standardize touchscreen initialization interfaces for all boards
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4721 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/libnxwidgets')
-rw-r--r--NxWidgets/libnxwidgets/src/cnxserver.cxx86
1 files changed, 45 insertions, 41 deletions
diff --git a/NxWidgets/libnxwidgets/src/cnxserver.cxx b/NxWidgets/libnxwidgets/src/cnxserver.cxx
index dc6316835..be67e5641 100644
--- a/NxWidgets/libnxwidgets/src/cnxserver.cxx
+++ b/NxWidgets/libnxwidgets/src/cnxserver.cxx
@@ -232,47 +232,51 @@ bool CNxServer::connect(void)
m_hNxServer = nx_connect();
if (m_hNxServer)
{
- pthread_attr_t attr;
-
- // Start a separate thread to listen for server events. This is probably
- // the least efficient way to do this, but it makes this logic flow more
- // smoothly.
-
- (void)pthread_attr_init(&attr);
- param.sched_priority = CONFIG_NXWIDGETS_LISTENERPRIO;
- (void)pthread_attr_setschedparam(&attr, &param);
- (void)pthread_attr_setstacksize(&attr, CONFIG_NXWIDGETS_LISTENERSTACK);
-
- m_stop = false;
- m_running = true;
-
- ret = pthread_create(&thread, &attr, listener, (FAR void *)this);
- if (ret != 0)
- {
- gdbg("NxServer::connect: pthread_create failed: %d\n", ret);
- m_running = false;
- disconnect();
- return false;
- }
-
- // Don't return until we are connected to the server
-
- while (!m_connected && m_running)
- {
- // Wait for the listener thread to wake us up when we really
- // are connected.
-
- (void)sem_wait(&m_connsem);
- }
-
- // In the successful case, the listener is still running (m_running)
- // and the server is connected (m_connected). Anything else is a failure.
-
- if (!m_connected || !m_running)
- {
- disconnect();
- return false;
- }
+ pthread_attr_t attr;
+
+ // Start a separate thread to listen for server events. This is probably
+ // the least efficient way to do this, but it makes this logic flow more
+ // smoothly.
+
+ (void)pthread_attr_init(&attr);
+ param.sched_priority = CONFIG_NXWIDGETS_LISTENERPRIO;
+ (void)pthread_attr_setschedparam(&attr, &param);
+ (void)pthread_attr_setstacksize(&attr, CONFIG_NXWIDGETS_LISTENERSTACK);
+
+ m_stop = false;
+ m_running = true;
+
+ ret = pthread_create(&thread, &attr, listener, (FAR void *)this);
+ if (ret != 0)
+ {
+ gdbg("NxServer::connect: pthread_create failed: %d\n", ret);
+ m_running = false;
+ disconnect();
+ return false;
+ }
+
+ // Detach from the thread
+
+ (void)pthread_detach(thread);
+
+ // Don't return until we are connected to the server
+
+ while (!m_connected && m_running)
+ {
+ // Wait for the listener thread to wake us up when we really
+ // are connected.
+
+ (void)sem_wait(&m_connsem);
+ }
+
+ // In the successful case, the listener is still running (m_running)
+ // and the server is connected (m_connected). Anything else is a failure.
+
+ if (!m_connected || !m_running)
+ {
+ disconnect();
+ return false;
+ }
}
else
{