Add serialize and deserialize methods
lars-t-hansen opened this issue · 0 comments
lars-t-hansen commented
Lock and Cond have no mutable state and are basically copyable and hence serializable, and we should make it possible to use that capability.
We could perhaps add a serialize
instance method that produces a recognizable structure, eg, an object with a field typeIsLock:true
or typeIsCond:true
and other data fields that are implementation-dependent, and static methods on Lock and Cond that can accept these objects.
Or perhaps the better solution is to hook into the JSON machinery, even though JSON can't represent a SharedArrayBuffer reference.
Either way we want something that can be postMessage'd and restored properly in the receiver.