Thanks

czwartek, 29 lipca 2021 o 20:30:46 UTC+2 alarm...@gmail.com napisaƂ(a):

> There is a happens before edge between calling the start method of a 
> thread and the thread running.
>
> On JMM level that is sufficient. 
>
> On Thu, Jul 29, 2021, 18:47 r r <gros...@gmail.com> wrote:
>
>> 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 mechanical-symp...@googlegroups.com.
>> To view this discussion on the web, visit 
>> https://groups.google.com/d/msgid/mechanical-sympathy/84ab88bc-e0bf-4e19-8c39-eeea619bf0f0n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/mechanical-sympathy/84ab88bc-e0bf-4e19-8c39-eeea619bf0f0n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 mechanical-sympathy+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/mechanical-sympathy/28b5554f-c621-4b15-ae78-76f830684ddcn%40googlegroups.com.

Reply via email to