multithreading

What are the cause(s) of input touch/display lag in android?

China☆狼群 提交于 2020-02-23 04:52:00
问题 I have a very simple app that render a square with opengl, input touch are read by the GLSurfaceView and last position is exchanged with the rendering thread using a volatile variable. What I observe (and as been also very well described in https://www.mail-archive.com/android-developers@googlegroups.com/msg235325.html) is that there is a delay (a lag) between the touch position and the display. When activating the developer option to show touch position, I see that when moving rapidly: the

What are the cause(s) of input touch/display lag in android?

六眼飞鱼酱① 提交于 2020-02-23 04:51:53
问题 I have a very simple app that render a square with opengl, input touch are read by the GLSurfaceView and last position is exchanged with the rendering thread using a volatile variable. What I observe (and as been also very well described in https://www.mail-archive.com/android-developers@googlegroups.com/msg235325.html) is that there is a delay (a lag) between the touch position and the display. When activating the developer option to show touch position, I see that when moving rapidly: the

In Android how to stop a thread that is wating for a new Socket

北城余情 提交于 2020-02-22 13:03:11
问题 I'm developing a software that connects to a server using a Socket; connectionThread = new Thread(new Runnable( ) { public void run() { InetAddress serverAddress = InetAddress.getByName(ip); serverSocket = new Socket(serverAddress, port); //do more stuff } }); connectionThread.start(); When the client does not connect to the server the Thread keeps waiting for the return of the new Socket until timeout is reached. I want to enable the user to cancel that action. I tried then to call

ActiveMQ Transport Thread is not terminated when main ends

早过忘川 提交于 2020-02-22 07:39:06
问题 This is how I start connection: factory = new PooledConnectionFactory(brokerURL); brokerURL is "failover:(tcp://host1.com:61616,tcp://host2.com:61616)?randomize=false&jms.useAsyncSend=false&jms.dispatchAsync=false&maxReconnectAttempts=30&maxReconnectDelay=3000" Connection is started: connection = factory.createConnection("", ""); connection.start(); Application performs its usual tasks before connections gets closed: connection.close(); main method is finished, but JVM is not, because there

ActiveMQ Transport Thread is not terminated when main ends

此生再无相见时 提交于 2020-02-22 07:35:22
问题 This is how I start connection: factory = new PooledConnectionFactory(brokerURL); brokerURL is "failover:(tcp://host1.com:61616,tcp://host2.com:61616)?randomize=false&jms.useAsyncSend=false&jms.dispatchAsync=false&maxReconnectAttempts=30&maxReconnectDelay=3000" Connection is started: connection = factory.createConnection("", ""); connection.start(); Application performs its usual tasks before connections gets closed: connection.close(); main method is finished, but JVM is not, because there

boost thread pool

送分小仙女□ 提交于 2020-02-22 05:29:49
问题 I need a threadpool for my application, and I'd like to rely on standard (C++11 or boost) stuff as much as possible. I realize there is an unofficial(!) boost thread pool class, which basically solves what I need, however I'd rather avoid it because it is not in the boost library itself -- why is it still not in the core library after so many years? In some posts on this page and elsewhere, people suggested using boost::asio to achieve a threadpool like behavior. At first sight, that looked

boost thread pool

大兔子大兔子 提交于 2020-02-22 05:29:35
问题 I need a threadpool for my application, and I'd like to rely on standard (C++11 or boost) stuff as much as possible. I realize there is an unofficial(!) boost thread pool class, which basically solves what I need, however I'd rather avoid it because it is not in the boost library itself -- why is it still not in the core library after so many years? In some posts on this page and elsewhere, people suggested using boost::asio to achieve a threadpool like behavior. At first sight, that looked

Lock on an object that might change during code execution

馋奶兔 提交于 2020-02-21 13:09:47
问题 Let's suppose I have a thread that locks on an object reference Thread #1 lock(myObj) { ... } later in code I have myObj = new XYZObj(); and then Thread #2 locks on it lock(myObj) { ... } Will this code be thread safe, if the object reference has changed? When the object reference changes, the first lock is still valid? 回答1: Locks work on instances, not variables. The lock statement will hold its own reference to the instance so that it will only exit the instance you entered. The spec says:

Lock on an object that might change during code execution

拟墨画扇 提交于 2020-02-21 13:08:33
问题 Let's suppose I have a thread that locks on an object reference Thread #1 lock(myObj) { ... } later in code I have myObj = new XYZObj(); and then Thread #2 locks on it lock(myObj) { ... } Will this code be thread safe, if the object reference has changed? When the object reference changes, the first lock is still valid? 回答1: Locks work on instances, not variables. The lock statement will hold its own reference to the instance so that it will only exit the instance you entered. The spec says:

Lock on an object that might change during code execution

情到浓时终转凉″ 提交于 2020-02-21 13:02:41
问题 Let's suppose I have a thread that locks on an object reference Thread #1 lock(myObj) { ... } later in code I have myObj = new XYZObj(); and then Thread #2 locks on it lock(myObj) { ... } Will this code be thread safe, if the object reference has changed? When the object reference changes, the first lock is still valid? 回答1: Locks work on instances, not variables. The lock statement will hold its own reference to the instance so that it will only exit the instance you entered. The spec says: