4,043 questions
1
vote
2
answers
643
views
What are atomic store types?
I've read the Core Data references on Apple's site. But I wonder, what they mean with atomic store types? They write something of "they have to be read and written in their entirety".
Could somebody ...
1
vote
3
answers
3k
views
Django, how to make a view atomic?
I have a simple django app to simulate a stock market, users come in and buy/sell. When they choose to trade,
the market price is read, and
based on the buy/sell order the market price is increased/...
26
votes
6
answers
7k
views
Are reads and writes to properties atomic in C#?
Reads and writes to certain primitive types in C# such as bool and int are atomic.
(See section 5.5, "5.5 Atomicity of variable references", in the C# Language Spec.)
But what about accessing such ...
0
votes
1
answer
778
views
MS Access Atomic Transactions
Is there any way to make microsoft access transactions atomic across multiple users?
I have found this which seems to imply that they are not, but I am wondering if atomicity in access is driver ...
0
votes
4
answers
361
views
Thread safety... what's my "best" course of action?
I'm wondering what is the "best" way to make data thread-safe.
Specifically, I need to protect a linked-list across multiple threads -- one thread might try to read from it while another thread adds/...
13
votes
2
answers
23k
views
Is there support for lock-free operations such as CAS in the standard library?
I'm implementing a lock-free mechanism using atomic (double) compare and swap instructions e.g. cmpxchg16b
I'm currently writing this in assembly and then linking it in. However, I wondered if there ...
10
votes
1
answer
3k
views
Better way to implement a generic atomic load or store in GCC?
I am aware of GCC's builtin atomic operations: http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Atomic-Builtins.html
But this list doesn't include very simple operations like load and store. I could ...
6
votes
4
answers
660
views
Is there a way I can make two reads atomic?
I'm running into a situation where I need the atomic sum of two values in memory. The code I inherited goes like this:
int a = *MemoryLocationOne;
memory_fence();
int b = *MemoryLocationTwo;
return (...
2
votes
2
answers
6k
views
MSSQL: What happens when an error occurs during trigger execution?
Regarding Update and Insert triggers for MS SQL Server, is there a way to make them atomic? In other words, if an error occurs during the trigger, is it possible to automatically roll back the ...
1
vote
3
answers
1k
views
can linq update and query atomically?
I need to get 1000 rows from a database, and at the same time tag them as 'in process'.
This way, another thread can not take the same 1000 rows and process them as well.
With linq i do something ...
1954
votes
28
answers
541k
views
What's the difference between the atomic and nonatomic attributes?
What do atomic and nonatomic mean in property declarations?
@property(nonatomic, retain) UITextField *userName;
@property(atomic, retain) UITextField *userName;
@property(retain) UITextField *...
2
votes
8
answers
2k
views
Nonblocking algorithm to generate unique negative numbers
I recently refactored a piece of code used to generate unique negative numbers.
edit: Multiple threads obtain these ids and add as keys to a DB; numbers need to be negative to be easily identifiable -...
3
votes
6
answers
1k
views
How to safely update a file that has many readers and one writer?
I have a set of files. The set of files is read-only off a NTFS share, thus can have many readers. Each file is updated occasionally by one writer that has write access.
How do I ensure that:
If the ...
8
votes
3
answers
2k
views
What's the best way to do a cross-platform, atomic file replacement in Perl?
I have a very common situation. I have a file, and I need to entirely overwrite that file with new contents. However, the original file is accessed on every page load (this is a web app), so it can't ...
0
votes
4
answers
2k
views
Is it possible to avoid a wakeup-waiting race using only POSIX semaphores? Is it benign?
I'd like to use POSIX semaphores to manage atomic get and put from a file representing a queue. I want the flexibility of having something named in the filesystem, so that completely unrelated ...
85
votes
10
answers
56k
views
Django: How can I protect against concurrent modification of database entries
If there a way to protect against concurrent modifications of the same data base entry by two or more users?
It would be acceptable to show an error message to the user performing the second commit/...
1
vote
4
answers
1k
views
Win32: Atomic Execution of Code Block
I have two system calls GetSystemTime() and GetThreadTimes() that I need to calculate the CPU utilization by a given Win32 thread.
For the sake of accuracy, I need to ensure that both GetSystemTime() ...
15
votes
8
answers
8k
views
Is this C++ implementation for an Atomic float safe?
Edit: The code here still has some bugs in it, and it could do better in the performance department, but instead of trying to fix this, for the record I took the problem over to the Intel discussion ...
13
votes
7
answers
9k
views
High-level Compare And Swap (CAS) functions?
I'd like to document what high-level (i.e. C++ not inline assembler ) functions or macros are available for Compare And Swap (CAS) atomic primitives...
E.g., WIN32 on x86 has a family of functions ...
15
votes
7
answers
14k
views
Interlocked equivalent on Linux
In a C++ Linux app, what is the simplest way to get the functionality that the Interlocked functions on Win32 provide? Specifically, a lightweight way to atomically increment or add 32 or 64 bit ...
21
votes
7
answers
19k
views
How to implement thread safe reference counting in C++
How do you implement an efficient and thread safe reference counting system on X86 CPUs in the C++ programming language?
I always run into the problem that the critical operations not atomic, and ...
98
votes
16
answers
44k
views
Are C++ Reads and Writes of an int Atomic? [duplicate]
I have two threads, one updating an int and one reading it. This is a statistic value where the order of the reads and writes is irrelevant.
My question is, do I need to synchronize access to this ...