|
I was worrying about race conditions in an application I'm designing, when I was wondering about this question.
Let's say I have a large array or collection of some sort that is managed by one component of my program, let's call that component Monitor...
Started by Hanno Fietz on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
See also: Is accessing a variable in C# ....
You have to read it to know if it's locked, so you .
Setting a 32-bit (at least in .NET) is atomic, but it does you no good.
See this question for why and what to do about it .
No, it's not atomic.
|
|
In multi-thread environment, in order to have thread safe array element swapping, we will perform synchronized locking.
// a is char array. synchronized(a) { char tmp = a[1]; a[1] = a[0]; a[0] = tmp; }
Is it possible that we can make use of the following...
Started by Yan Cheng CHEOK on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
AFAIK, all the classes in java.util.concurrent.atomic only provide atomic....
I don't think the AtomicReferenceFieldUpdater is meant for array access, and even if it were, it only provides atomic guarantees on one reference at a time.
|
|
Is there a way to declare array elements volatile in Java? I.e.
volatile int[] a = new int[10];
declares the array reference volatile , but the array elements (e.g. a[1] ) are still not volatile. So I'm looking for something like
volatile int[] a = new...
Started by Joonas Pulakka on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
See also httpuse AtomicIntegerArray or AtomicLongArray
The AtomicIntegerArray class implements an int array/j2se/1.5.0/docs/api/java/util/concurrent/....
Concurrent/atomic/package-summary.html
No, you can't make array elements volatile.
|
Ask your Facebook Friends
|
Problem: I cannot understand the number 256 (2^8) in the extract of the IBM article :
On the other hand, if it's a big-endian system, the high byte is 1 and the value of x is 256.
Assume each element in an array consumes 4 bites, then the processor should...
Started by Masi on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Answering your followup question: briefly....
Big endian would interpret that bit array read left to right; little endian would swap the two bytes.
Writing out the bits, it's an array of { 1_{base2}, _{base2}}.
Or (short)1 on little-endian.
|
|
A question asked here recently reminded me of a debate I had not long ago with a fellow programmer. Basically he argued that zero-based arrays should be replaced by one-based arrays since arrays being zero based is an implementation detail that originates...
Started by DrJokepu on
, 39 posts
by 39 people.
Answer Snippets (Read the full thread at stackoverflow):
However, 99% of the work math basically works like....
Next
At the most atomic level, its simply due down of the array, it's just an implementation detail that it is called 3 or 2.
array) ub = UBound(array) for i = lb to ub '...
|
|
I was helping a friend with some C++ homework. I warned said friend that the kind of programming I do (PHP, Perl, Python) is pretty different from C++, and there were no guarantees I wouldn't tell horrible lies.
I was able to answer his questions, but...
Started by Alan Storm on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Had the array been....
Error: ISO C++ forbids variable-size array
You are getting ABC???? because it prints the contents of the array ( ABC ) and continues to print until it encounters a \0 .
This with -Wall and -pedantic flags in g++.
|
|
Quark I cant find any images of an atomic structure and molecules or lattice structures for the following:
Tugsten
Polyethelene
Silicon Carbide
Quartz Crystal
Glass Fibre Reinforced Plastic
Shape Memory Polymer
If you have any links to where I could find...
Started by ben1793 on
, 20 posts
by 3 people.
Answer Snippets (Read the full thread at scienceforums):
Of the materials I had listed above, I was told that I have to draw an image of the atom itself, the atomicQuark need to find a tugsten atom (bohr diagram) and a crystal structure (lattice structure)
I cant:
need to find a tugsten atom....
|
|
This is a High Impact security update to correct the recently announce hash collision vulnerability. It is highly recommended for all platforms running PHP to upgrade to this release.
This update also includes a new mysqlnd sub package. This is a native...
Started by scott on
, 12 posts
by 6 people.
Answer Snippets (Read the full thread at atomicorp):
Version is atm:
php-5.3.8-1.el5.art
Thanx in advanced No, 5.3.8-2 and up in Atomic have dependencies, so upgrading PHP 5.3.8-1 to 5.3.9 using the Atomic repository is also not possible yet.
|
|
I want to use Thread.VolatileWrite() (or an equivalent function) to change the value of a T[] field, so that the updated value is immediately visible to all other threads. However, the method does not provide a generic version, and I'm not able to use...
Started by Hosam Aly on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Interlocked.Exchange<T> simply performs the get and set as an atomic operation.
Of readers).
|
|
Posted 18 January 2012 - 08:00 PM
Hi all,
The following program used the implementation of atomic locks from 'Cuda By Example', but running the program makes my machine frozen.
Can someone tell me what's wrong with my program? Thanks a lot
Yifei
#include...
Started by yifli on
, 7 posts
by 5 people.
Answer Snippets (Read the full thread at nvidia):
Ind++; atomicExch(&flag,0); }
Pratically, each thread must write in a different position of array.
|