Changeset 50639 in vbox
- Timestamp:
- Feb 27, 2014 8:16:44 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 92533
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp
r50593 r50639 14 14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 15 15 */ 16 17 #include <errno.h> 18 #include <poll.h> 16 19 17 20 #include <X11/Xlib.h> … … 416 419 , m_hEventSem(NIL_RTSEMEVENT) 417 420 , m_pCurDnD(0) 418 , m_fSrvStopping(false)419 421 {} 420 422 … … 465 467 RTSEMEVENT m_hEventSem; 466 468 DragInstance *m_pCurDnD; 467 bool m_fSrvStopping;468 469 469 470 friend class DragInstance; … … 1749 1750 } 1750 1751 } 1751 } while (!ASMAtomicReadBool(&m_fSrvStopping)); 1752 XFlush(m_pDisplay); 1753 } while (1); 1752 1754 } while (0); 1753 1755 … … 1839 1841 } 1840 1842 1841 } while ( !ASMAtomicReadBool(&pThis->m_fSrvStopping));1843 } while (1); 1842 1844 1843 1845 VbglR3DnDDisconnect(uClientID); … … 1854 1856 do 1855 1857 { 1856 /* Wait for new events. We can't use XIfEvent here, cause this locks1858 /* Wait for new events. We can't use XIfEvent here, because this locks 1857 1859 * the window connection with a mutex and if no X11 events occurs this 1858 * blocks any other calls we made to X11. So instead check for new 1859 * events and if there are not any new one, sleep for a certain amount 1860 * of time. */ 1860 * blocks any other calls we made to X11. So instead poll for new events 1861 * on the connection file descriptor. */ 1862 /** @todo Make sure the locking is right - Xlib displays should never be 1863 * used from two threads at once. */ 1861 1864 if (XEventsQueued(pThis->m_pDisplay, QueuedAfterFlush) > 0) 1862 1865 { … … 1873 1876 } 1874 1877 else 1875 RTThreadSleep(25); 1876 } while (!ASMAtomicReadBool(&pThis->m_fSrvStopping)); 1878 { 1879 struct pollfd pollFD; 1880 1881 pollFD.fd = ConnectionNumber(pThis->m_pDisplay); 1882 pollFD.events = POLLIN | POLLPRI; 1883 if ( (poll(&pollFD, 1, -1) < 0 && errno != EINTR) 1884 || pollFD.revents & POLLNVAL) 1885 { 1886 LogRel(("X11 event thread: poll failed, stopping.\n")); 1887 /** @todo Just stop the whole service. What use is it just 1888 * to stop one thread? */ 1889 return RTErrConvertFromErrno(errno); 1890 } 1891 } 1892 } while (1); 1877 1893 1878 1894 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.