On Tuesday, 3 December 2024 at 23:16:00 UTC, Richard (Rikki)
Andrew Cattermole wrote:
What owned by a thread means is that a pointer is guaranteed to
only be accessible by that thread. I.e. the cpu will segfault
if you try to access it from another thread.
My experience is that aside from thre
On 04/12/2024 11:20 AM, Ali Çehreli wrote:
On 12/3/24 9:47 AM, Richard (Rikki) Andrew Cattermole wrote:
> On 04/12/2024 6:37 AM, Nick Treleaven wrote:
>> |shared| - shared (i.e. accessible) across threads.
>
> That is already true.
That conflicts with my knowledge of data being thread-local
On 12/3/24 9:47 AM, Richard (Rikki) Andrew Cattermole wrote:
> On 04/12/2024 6:37 AM, Nick Treleaven wrote:
>> |shared| - shared (i.e. accessible) across threads.
>
> That is already true.
That conflicts with my knowledge of data being thread-local by default in D.
> You don't need a type quali
On 04/12/2024 6:37 AM, Nick Treleaven wrote:
If you use it to indicate anything other than the variable can only
be accessed/mutated via atomic operations, you are at best lieing to
yourself about the native memory model.
All memory is owned by the process, until proven otherwise
On Monday, 2 December 2024 at 21:55:55 UTC, Richard (Rikki)
Andrew Cattermole wrote:
As a type qualifier/storage class, ``shared`` should be called
``atomic``.
`shared` is more accurate. Atomic ops are not the only way
intended to mutate `shared` data. In fact atomic ops can be
slower.
If y
On 03/12/2024 4:18 AM, Salih Dincer wrote:
On Monday, 2 December 2024 at 08:00:40 UTC, Richard (Rikki) Andrew
Cattermole wrote:
You don't need both atomics an mutex's, pick one.
The compiler wants us to use atomicOp; If you want, take it out of the
synchronized(mutex) { } block, it doesn't ma
On 12/2/24 7:18 AM, Salih Dincer wrote:
> On Monday, 2 December 2024 at 08:00:40 UTC, Richard (Rikki) Andrew
> Cattermole wrote:
>> You don't need both atomics an mutex's, pick one.
>
> The compiler wants us to use atomicOp; If you want, take it out of the
> synchronized(mutex) { } block, it doesn
On Monday, 2 December 2024 at 08:00:40 UTC, Richard (Rikki)
Andrew Cattermole wrote:
You don't need both atomics an mutex's, pick one.
The compiler wants us to use atomicOp; If you want, take it out
of the synchronized(mutex) { } block, it doesn't matter:
onlineapp.d(20): Error: read-modify-
You don't need both atomics an mutex's, pick one.
On Monday, 2 December 2024 at 02:29:39 UTC, Ali Çehreli wrote:
...
There are several other methods of communicating the request..
I've slightly edited the code that the AI generates. Ali, how is
it now, can we say that it is the best method?
```d
import core.thread;
import core.atomic;
impor
On Monday, 2 December 2024 at 02:02:56 UTC, Ritina wrote:
How can I implement a program where I have a global integer
variable g, and three threads: the first thread increments g by
1, the second thread increments g by 2, and the third thread
increments g by 3? Additionally, while these threads
On Monday, 2 December 2024 at 02:29:39 UTC, Ali Çehreli wrote:
I am not sure whether
stopRequested = true
is correct even when there is a single writer of that variable.
There are several other methods of communicating the request. I
chose that one for this example.
I notice core.atomic h
On Monday, 2 December 2024 at 02:02:56 UTC, Ritina wrote:
How can I implement a program where I have a global integer
variable g, and three threads: the first thread increments g by
1, the second thread increments g by 2, and the third thread
increments g by 3? Additionally, while these threads
On 12/1/24 6:23 PM, Andy Valencia wrote:
On Monday, 2 December 2024 at 02:02:56 UTC, Ritina wrote:
How can I implement a program where I have a global integer variable
g, and three threads: the first thread increments g by 1, the second
thread increments g by 2, and the third thread increments
How can I implement a program where I have a global integer
variable g, and three threads: the first thread increments g by
1, the second thread increments g by 2, and the third thread
increments g by 3? Additionally, while these threads are running,
I should be able to access the value of g bo
15 matches
Mail list logo