Feature #5371

add marshalling support for Mutex

Added by Suraj Kurapati over 2 years ago. Updated about 2 years ago.

[ruby-core:39734]
Status:Rejected
Priority:Normal
Assignee:-
Category:core
Target version:2.0.0

Description

Hello,

Please add marshalling support for the Mutex class:

$ irb

Marshal.dump(Mutex.new)
TypeError: no marshal_dump is defined for class Mutex
from (irb):1:in dump'
from (irb):1
from /usr/bin/irb:12:in
'

Here is the workaround I am currently using:

class Mutex
def marshaldump
[]
end
def marshal
load array
# do nothing
end
end

Thanks for your consideration.

History

#1 Updated by Motohiro KOSAKI over 2 years ago

Hello,

Please add marshalling support for the Mutex class:

$ irb

Marshal.dump(Mutex.new)
TypeError: no marshal_dump is defined for class Mutex
       from (irb):1:in dump'
       from (irb):1
       from /usr/bin/irb:12:in
'

Because of, Almost all OSs don't have a way to restore mutex locking state.
I have no idea how implement it. ;-)

Here is the workaround I am currently using:

class Mutex
 def marshaldump
   []
 end
 def marshal
load array
   # do nothing
 end
end

Thanks for your consideration.

Hmmm??
It seems locking state lost. Is this acceptable?

#2 Updated by Yusuke Endoh about 2 years ago

  • Status changed from Open to Rejected

There is no feedback or revised proposal from OP.
I close this as Rejected.

Yusuke Endoh mame@tsg.ne.jp

Also available in: Atom PDF