Thread overview
[phobos] I wrote NamedMutex for IPC
May 07, 2010
SHOO
May 07, 2010
Sean Kelly
May 08, 2010
SHOO
May 10, 2010
Sean Kelly
May 08, 2010
Me challenge at this time is NamedMutex.

http://ideone.com/EKYBO

The module about IPC is not included in Phobos and druntime at all now.
I suggest NamedMutex by this contribution experimentally.
NamedMutex can operate like normal Mutex. But NamedMutex allows
reference by name over the process.
This may help that file locking in CGI, restraint of the multi-running
process, etc...

What do you think?

P.S.
I can say with confidence this time. "I do not see Tango at all."

May 07, 2010
On May 7, 2010, at 10:49 AM, SHOO wrote:

> Me challenge at this time is NamedMutex.
> 
> http://ideone.com/EKYBO
> 
> The module about IPC is not included in Phobos and druntime at all now.
> I suggest NamedMutex by this contribution experimentally.
> NamedMutex can operate like normal Mutex. But NamedMutex allows
> reference by name over the process.
> This may help that file locking in CGI, restraint of the multi-running
> process, etc...
> 
> What do you think?

I think it's a good idea.  I would have created one already, but the differences between Win32 and Posix named mutexes are fairly substantial, and I haven't spent the time to figure out how to hide the differences in a way that would make both camps happy.  It would be nice if it were possible to have a SharedCondition class that integrates with this as well, though that may turn out to be a tad tricky.

> I can say with confidence this time. "I do not see Tango at all."

They don't exist in Tango.  I know because I created tango.core.sync, which is reflected in core.sync in druntime.
May 08, 2010
Sean Kelly ????????:
> On May 7, 2010, at 10:49 AM, SHOO wrote:
> 
>> Me challenge at this time is NamedMutex.
>>
>> http://ideone.com/EKYBO
>>
>> The module about IPC is not included in Phobos and druntime at all now.
>> I suggest NamedMutex by this contribution experimentally.
>> NamedMutex can operate like normal Mutex. But NamedMutex allows
>> reference by name over the process.
>> This may help that file locking in CGI, restraint of the multi-running
>> process, etc...
>>
>> What do you think?
> 
> I think it's a good idea.  I would have created one already, but the differences between Win32 and Posix named mutexes are fairly substantial, and I haven't spent the time to figure out how to hide the differences in a way that would make both camps happy.  It would be nice if it were possible to have a SharedCondition class that integrates with this as well, though that may turn out to be a tad tricky.
> 
>> I can say with confidence this time. "I do not see Tango at all."
> 
> They don't exist in Tango.  I know because I created tango.core.sync, which is reflected in core.sync in druntime.

Thank you.

SharedCondition sounds good.

Though I examined it a little, I think impremention of SharedCondition
is difficult because there are not supports from OS.
If there is NamedSemaphore, it may be possible. But the implementation
will become the way that is not so smart even if I implement it by force.
Isn't there good method?

May 09, 2010
On May 8, 2010, at 5:47 AM, SHOO wrote:
> 
> Though I examined it a little, I think impremention of SharedCondition is difficult because there are not supports from OS.
> If there is NamedSemaphore, it may be possible. But the implementation will become the way that is not so smart even if I implement it by force.
> Isn't there good method?

I've never done it before, but on Posix I think you can use pthread_condattr_setpshared to make a condvar shared.  On Windows it would obviously be a lot more difficult--all the semaphores and such in the algorithm would have to be named.  See eg: http://msdn.microsoft.com/en-us/library/ms682438(v=VS.85).aspx