synchronization

Is it safe to access VT data from the other thread?

时光总嘲笑我的痴心妄想 提交于 2019-12-21 17:52:10
问题 Is it safe to change VirtualTreeView data from the secondary thread ? And if yes, should I use critical sections (or even Synchronize method) ? I'm afraid that when I'll be writing to the VT's data record from the other thread, main thread invokes its repaint meanwhile and this refresh will cause reading of the same record at one time. I would supplement I'm using only 2 threads in the application. Something like ... type PSomeRecord = ^TSomeRecord; TSomeRecord = record SomeString: string;

C++ Access to vector from multiple threads

情到浓时终转凉″ 提交于 2019-12-21 17:43:41
问题 In my program I've some threads running. Each thread gets a pointer to some object (in my program - vector). And each thread modifies the vector. And sometimes my program fails with a segm-fault. I thought it occurred because thread A begins doing something with the vector while thread B hasn't finished operating with it? Can it bee true? How am I supposed to fix it? Thread synchronization? Or maybe make a flag VectorIsInUse and set this flag to true while operating with it? 回答1: vector ,

Is entering synchronized block atomic?

只谈情不闲聊 提交于 2019-12-21 17:38:09
问题 Do you know if there is guaranteed that synchronized block in java is atomic? Imagine following case Thread_1,2: synchronized(object){object.modify();} (object is shared variable.) imagine thread_M will change reference to object like synchronized(object){object = new Object()} now imagine threads 1 and 2 are competing over getting the lock on object Is it possible that following would happened: 1. Thread1: read old object 2. ThreadM: modify object reference & release old object lock 3.

Windows Mobile Synchronization Error

三世轮回 提交于 2019-12-21 16:58:04
问题 I am new to Windows Mobile development and have been investigating methods to synchronize data between PDA's running WM6 and a SQL Server 2005 Database. After some research I decided to go with Windows Synchronization Services. I started by looking at the sample: SyncServicesForDevicesSample I downloaded and installed all the prerequisite software outlined in the readme including: Visual Studio 2008 Professional SP1 SQL Server Compact 3.5 Service Pack 1 (SP1) Synchronization Services for ADO

When to flush a file in Go?

泄露秘密 提交于 2019-12-21 07:24:44
问题 When is it necessary to flush a file? I never do it because I call File.Close and I think that it is flushed automatically, isn't it? 回答1: You'll notice that an os.File doesn't have a .Flush() because it doesn't need one because it isn't buffered. Writes to it are direct syscalls to write to the file. When your program exits(even if it crashes) all files it has open will be closed automatically by the operating system and the file system will write your changes to disk when it gets around to

how to synchronize display of multiple android devices?

喜你入骨 提交于 2019-12-21 06:45:08
问题 I was thinking of using multiple Android devices (e.g. Nexus 7 tablets) to build a photo / video wall and I'm wondering a) whether it is possible and b) how to synchronize the display of all these devices. Google showed off its Chrome racer experiment so clearly it is possible to synchronize displays across many devices. So here are my questions: what technology should I use to synchronize the displays? Android? Chrome? Please point me to existing code if possible. what's the minimum lag

Is it possible to display one object multiple times in a VirtualStringTree?

早过忘川 提交于 2019-12-21 06:18:41
问题 I realize that I really need to rewrite my programs data structure (not now, but soon, as the deadline is monday), as I am currently using VST (VirtualStringTree) to store my data. What I would like to achieve, is a Contact List structure. The Rootnodes are the Categories, and the children are the Contacts. There is a total of 2 levels. The thing is though, that I need a contact to display in more than 1 category, but they need to be synchronized. Particularly the Checkstate . Currently, to

Is it possible to modify a non-volatile variable such that another thread is able to “see” the update?

六月ゝ 毕业季﹏ 提交于 2019-12-21 05:46:09
问题 I have a Thread-X which reads a non-volatile variable every second, doing so without any means of synchronization. Now I was wondering is there some way to modify that non-volatile variable on Thread-Y such that Thread-Y's write would be (eventually) visible on Thread-X ? public class Test { private static boolean double = 1; // this variable is // strictly not volatile public static void main(String args[]) { new java.lang.Thread(new java.lang.Runnable() { @Override public void run() { while

Django Multiple Databases - One not always available

时光总嘲笑我的痴心妄想 提交于 2019-12-21 05:11:24
问题 I am developing a Django application which will use multiple database backends. I would like to put an sqlite database on the machine running the django application, and sync to a remote mysql database. The tricky part is that this machine running the application will not always have an internet connection, so the mysql database is not always availalble. There will be multiple machines running the application, each with it's own local sqlite DB, but all using the same remote mysql DB. I haven

How to implement offline capable Single Page Application with Breeze.js and HTML5 local storage

心不动则不痛 提交于 2019-12-21 05:00:22
问题 I have working Single Page Application using Breeze.js for Data Access. It uses the Breeze.js to execute queries against the local cache and the data is requested only once at start up. Only the data updates are posted back on the server afterwards. I am looking for a solution to make the application connection aware. If the mobile device does not have internet connection the changes will be saved locally with Breeze.js and HTML5 local storage. When the mobile device is back online the