Sencha触摸jQuery Mobile(Sencha Touch over jquery Mobile)
Sencha Touch的主要功能是什么jQueryMobile我不明白。 根据我对这两项技术的了解:
1) jQueryMobile为跨平台移动平台的设计应用程序提供了非常简单的数据属性功能,但与Sencha Touch相比 。
2)与jQuery Mobile相比, Sencha Touch有一个新概念,它们的结构对于实现页面设计来说非常困难。然后Sencha和jqueryMobile的意义是什么?他们在哪个领域扮演重要角色?
What is main feature of Sencha Touch over jQueryMobile I don't understand. as per my knowledge about this two technology:
1) jQueryMobile have very simple data attribute feature for design app for cross mobile platform but as compare to Sencha Touch.
2) Sencha Touch have new concept and their structure to implement designing for page is very difficult compare to jQuery Mobile.
Then What is significance of Sencha and jqueryMobile and What is their own area in Which they both play role significantly ?
原文:https://stackoverflow.com/questions/17807056
最满意答案
您可以将所需的任何数据传递给
Thread.Start()
方法。 这基本上是在线程之间共享内容的首选方式。 但是,在基本级别,如果多个线程要访问其他线程,那么您需要建立某种锁定机制以确保您没有争用问题。假设您在线程之间共享一个全局级别的类实例:
(这是C#,但你明白了)
class GlobalData { public string SomeProperty {get; set; } public int SomeOtherProperty {get; set; } }
多个线程同时访问这些属性中的任何一个(或者期望值在调用之间保持一致)的情况将会很麻烦。 所以最简单的方法是创建一个线程负责的锁定机制:
class GlobalData { public object Sentry = new object(); public string SomeProperty {get; set; } public int SomeOtherProperty {get; set; } }
在运行线程的代码中,你会做这样的事情(假设
g_Data
是类的实例):void SomeMethodRunningOnAThread() { lock (g_Data.Sentry) { // do stuff } }
(在VB.NET中相当于
lock
是SyncLock
)这是确保您不会遇到争用问题的最简单方法。 每个线程负责确保在访问对象之前尝试锁定对象。
除此之外,当然还有一些方法可以对此进行细化,例如在包含全局数据的类中实现锁定逻辑。 它不会变得那么复杂,所以如果你想要实现更复杂的东西,你最后还是必须阅读。
You can pass any data you want to the
Thread.Start()
method. That's basically the preferred way of sharing stuff between threads. However, at a basic level, if more than one of the threads is going to access something that the others will as well, you need to establish some kind of locking mechanism to ensure you don't have contention issues.Let's say you have a class instance at the global level that is shared among your threads:
(this is C# but you get the idea)
class GlobalData { public string SomeProperty {get; set; } public int SomeOtherProperty {get; set; } }
A scenario where more than one thread accesses any of these properties at the same time (or expect the value to be consistent across calls) would be trouble. So the easiest way is to create a locking mechanism where the thread is responsible:
class GlobalData { public object Sentry = new object(); public string SomeProperty {get; set; } public int SomeOtherProperty {get; set; } }
In the code that runs the threads, you would do something like this (assuming
g_Data
is the instance of the class):void SomeMethodRunningOnAThread() { lock (g_Data.Sentry) { // do stuff } }
(in VB.NET the equivalent to
lock
isSyncLock
)This is the simplest way to ensure you don't get into contention issues. Each thread is responsible for ensuring that they are attempting a lock on the object before accessing its contents.
Beyond that, there are of course ways to finesse this, such as implementing the lock logic within the class that contains the global data. It doesn't get less complicated, so if you want to implement something more complex in the end you'll have to read up anyway.
相关问答
更多-
在线程之间共享秒表(Share stopwatch between threads)[2022-10-19]
不要在多线程中“努力”:只需锁定连接的Stopwatch对象即可更新/读取它! var sw = socketInformation.GetStopwatch(); lock (sw) sw.Start(); 后来在另一个帖子中: var sw = socketInformation.GetStopwatch(); lock (sw) { sw.Stop(); long pingTime = sw.ElapsedMilliseconds; } Don't be a "try hard" at ... -
在线程之间共享信息(Share information between threads)[2021-08-21]
您可以将所需的任何数据传递给Thread.Start()方法。 这基本上是在线程之间共享内容的首选方式。 但是,在基本级别,如果多个线程要访问其他线程,那么您需要建立某种锁定机制以确保您没有争用问题。 假设您在线程之间共享一个全局级别的类实例: (这是C#,但你明白了) class GlobalData { public string SomeProperty {get; set; } public int SomeOtherProperty {get; set; } } 多个线程同时 ... -
在你的例子中,使Controller c final成为可能,然后通过构造函数或setter方法将它传递给GUI。 例如: final Controller c = new Controller(....) ; if(.... ) //manager { if (jRadioButton1.isSelected()) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() ...
-
以下是解释: 跨线程从第三方dll访问COM对象 。 应该使用: CoInitialize(0); CoInitializeEx(NULL, COINIT_MULTITHREADED); Here is the explanation: Access a COM object from a 3rd party dll across threads . Should use: CoInitialize(0); CoInitializeEx(NULL, COINIT_MULTITHREADED);
-
我不明白你的请求是如何可能的,至少不是没有一些非常聪明的无锁数据结构; 如果多个线程需要插入散列到同一位置的新值,会发生什么情况? 在以前的工作中,我使用了RwLock
>> 。 在哈希值中插入值时,您会在短时间内获得排它锁定。 剩下的时间,你可以拥有多个线程,读取器锁定HashMap ,从而给一个给定的元素。 如果他们需要改变数据,他们可以独占访问Mutex 。 这是一个例子: use std::collections::HashMap; use std::sync: ... -
为什么ThreadStatic数据在线程之间意外共享?(Why is ThreadStatic data being unexpectedly shared between threads?)[2021-11-23]
因为该字段不是静态的 。 它只适用于静态字段。 如果这是4.0,可能看看ThreadLocalBecause that field isn't static. It only applies to static fields. If this is 4.0, maybe look at ThreadLocal -
在线程之间共享数据(Share data between threads)[2022-11-11]
看看下面的例子。 public class Worker { public SharedData state; public void Work(SharedData someData) { this.state = someData; while (true) ; } } public class SharedData { X myX; public getX() { ... } public setX(anX) ... -
线程之间的共享内存(The shared memory between threads)[2021-08-13]
显然,您需要有关这些地址中发生的更多信息。 我建议使用pin的RTN_ *和IMG API来获取有关正在执行的例程的更多信息,然后检查反汇编程序中的相关图像。 您可以按代码源过滤访问,而不是按内存过滤。 只需避免使用作为系统库一部分的指令。 关于注释中的讨论,还应考虑您未检测到库使用的同步机制的情况。 Obviously you need more information about what's happening in these addresses. I recommend using pin's R ... -
在线程之间共享数据(sharing data between threads)[2022-01-18]
Java中的并发执行通常依赖于“共享内存”,因此只需确保两个线程中的代码共享对可以交换信息的公共数据结构的引用。 您需要确保的是,以同步/线程安全的方式访问此结构。 这可以通过使用synchronized关键字(不推荐)或使用java.util.concurrent包中的类(推荐)手动完成。 BlockingQueue可能很适合你。 你上这堂课时遇到了什么问题? 问题是从BlockingQueue读取的线程需要区分BlockingQ中写入的数据(来自user1,2,3的数据......)。 我建议你为Use ... -
如何使用multiprocessing.Pool在线程之间共享字典?(How to share dictionary between threads using multiprocessing.Pool?)[2023-06-05]
多处理使用单独的进程 ,而不是线程 。 这些进程不像线程一样共享所有内存。 要在进程之间共享数据 ,您可以使用例如multiprocessing.Value或multiprocessing.Array 。 但请注意,在某些情况下,您需要额外的锁定 。 使用Manager对象,您可以共享大多数数据类型(我认为它必须是可拾取的)。 共享内存的速度较慢。 或者您可以创建一个multiprocessing.Pipe来在进程之间交换数据。 备注 : 多处理模块在内部使用线程进行内务处理。 通常,最好避免在进程之间发送 ...