Hello,
We have the simple pseudocode:
void main(String[] args) {
MemoryBuffer b = new MemoryBuffer(); // it is a off-heap native piece
of memory allocated by malloc via JNI
b.init(); // it just write some data to the memory buffer by JNI
startThreadsThatReadsFromBuffer(b); // this functions starts threads
that read the b
// There is no locks / synchronization etc.
}
It seems to be thread-safe in the sense of Java Memory Model. But, I cannot
convince myself why it is correct. Especially, how can I be sure that
worker threads see completely intizalized buffer b?
--
You received this message because you are subscribed to the Google Groups
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web, visit
https://groups.google.com/d/msgid/mechanical-sympathy/84ab88bc-e0bf-4e19-8c39-eeea619bf0f0n%40googlegroups.com.