On 6/9/16 9:19 PM, cy wrote:
On Thursday, 9 June 2016 at 20:53:38 UTC, tcak wrote:
(cast()mx).lock();
I was told casting away shared when there are still references to it is
a bad idea. Like, the Mutex object might get corrupted if the garbage
collector tries to move it while another
On Thursday, 9 June 2016 at 20:53:38 UTC, tcak wrote:
(cast()mx).lock();
I was told casting away shared when there are still references to
it is a bad idea. Like, the Mutex object might get corrupted if
the garbage collector tries to move it while another thread is
using it.
So
On 6/9/16 2:31 PM, cy wrote:
Is core.sync.mutex.Mutex even usable in D anymore? It seems every mutex
that wasn't shared would be part of thread local data, so two threads
locking on the same mutex would actually be locking separate mutexes.
Yes, but this is because Mutex existed way before
On Thursday, 9 June 2016 at 18:31:16 UTC, cy wrote:
I was thinking of using threads in a D program (ignores
unearthly wailing) and I need 1 thread for each unique string
resource (database connection info). So I did this:
shared BackgroundDB[string] back;
I don't see any way to make less
On Sunday, 28 December 2014 at 20:36:07 UTC, ketmar via
Digitalmars-d-learn wrote:
you can turn that method to template. for now it is virtual
method and
compiler is unable to inline it.
Are you suggesting something like the following...
void lock(alias m)() if(is(typeof(m) ==
Or do you mean that I should simply make the property `final` so
it can be inlined?
On 12/28/14 10:24, Aiden via Digitalmars-d-learn wrote:
Is `shared` in a workable state?
No.
Shouldn't Mutex, Condition, etc be shared since they are basically only ever
useful when used in multiple threads?
Yes, but there are so many problems with 'shared' that
using it that way (even only
On Sunday, 28 December 2014 at 09:24:31 UTC, Aiden wrote:
Hello all,
This is my first post on these forums. I've been learning D for
the past couple of months or so and have been quite impressed
by the language thus far. One stumbling block that I have
encountered is with using `shared`, and
Thanks for the information. At least I've discovered a reasonably
tidy way of wrapping Mutex up so that it's not quite as painful
casting everything:
shared class SharedMutex {
private Mutex mutex;
private @property Mutex unsharedMutex() {
return cast(Mutex)mutex;
}
this() {
On Sun, 28 Dec 2014 20:21:45 +
Aiden via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
Thanks for the information. At least I've discovered a reasonably
tidy way of wrapping Mutex up so that it's not quite as painful
casting everything:
shared class SharedMutex {
10 matches
Mail list logo