new(kSameHeap, this) TFoo(arg)
newis defined as
*, size_t), and it allocates the storage in the
*argument's heap. If the argument doesn't point to a heap, the allocation occurs in the default heap. This guarantees that any storage this object refers to is going to be in the same shared heap so that it is accessible from all address spaces. Storage allocated in the default heap is accessible only from the address space in which it was allocated.
As with any shared memory, access to objects in your shared heap must be synchronized, unless they do not change once created. For example, if objects built using MReferenceCounted don't change, you need to synchronize the code that locates them, but not the code that uses them. Do any such synchronization with global rather than local semaphores.
[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.