void IXamarinSampleCommProxy.DetUpdateItemFork(CommInterfaceClasses.Item p_0)
        {
            SerializableTaskCompletionSource rpcTask;

            // Compute size of serialized arguments
            var totalArgSize = 0;

            // Argument 0
            int arg0Size = 0;

            byte[] arg0Bytes = null;

            arg0Bytes = Ambrosia.BinarySerializer.Serialize <CommInterfaceClasses.Item>(p_0);
            arg0Size  = IntSize(arg0Bytes.Length) + arg0Bytes.Length;

            totalArgSize += arg0Size;

            var wp = this.StartRPC <Boolean>(2 /* method identifier for DetUpdateItem */, totalArgSize, out rpcTask, RpcTypes.RpcType.FireAndForget);

            // Serialize arguments


            // Serialize arg0
            wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
            Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
            wp.curLength += arg0Bytes.Length;


            this.ReleaseBufferAndSend();
            return;
        }
        void IXamarinSampleCommProxy.ImpUpdateItemFork(CommInterfaceClasses.Item p_0)
        {
            if (!Immortal.IsPrimary)
            {
                throw new Exception("Unable to send an Impulse RPC while not being primary.");
            }

            SerializableTaskCompletionSource rpcTask;

            // Compute size of serialized arguments
            var totalArgSize = 0;

            // Argument 0
            int arg0Size = 0;

            byte[] arg0Bytes = null;

            arg0Bytes = Ambrosia.BinarySerializer.Serialize <CommInterfaceClasses.Item>(p_0);
            arg0Size  = IntSize(arg0Bytes.Length) + arg0Bytes.Length;

            totalArgSize += arg0Size;

            var wp = this.StartRPC <object>(5 /* method identifier for ImpUpdateItem */, totalArgSize, out rpcTask, RpcTypes.RpcType.Impulse);

            // Serialize arguments


            // Serialize arg0
            wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
            Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
            wp.curLength += arg0Bytes.Length;


            this.ReleaseBufferAndSend();
            return;
        }
        DetAddItemAsync(CommInterfaceClasses.Item p_0)
        {
            SerializableTaskCompletionSource rpcTask;
            // Make call, wait for reply
            // Compute size of serialized arguments
            var totalArgSize = 0;
            var p_1          = default(Boolean);
            int arg0Size     = 0;

            byte[] arg0Bytes = null;

            // Argument 0
            arg0Bytes = Ambrosia.BinarySerializer.Serialize <CommInterfaceClasses.Item>(p_0);
            arg0Size  = IntSize(arg0Bytes.Length) + arg0Bytes.Length;

            totalArgSize += arg0Size;

            var wp           = this.StartRPC <Boolean>(methodIdentifier: 1 /* method identifier for DetAddItem */, lengthOfSerializedArguments: totalArgSize, taskToWaitFor: out rpcTask);
            var asyncContext = new AsyncContext {
                SequenceNumber = Immortal.CurrentSequenceNumber
            };

            // Serialize arguments


            // Serialize arg0
            wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
            Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
            wp.curLength += arg0Bytes.Length;

            int taskId;

            lock (Immortal.DispatchTaskIdQueueLock)
            {
                while (!Immortal.DispatchTaskIdQueue.Data.TryDequeue(out taskId))
                {
                }
            }

            ReleaseBufferAndSend();

            Immortal.StartDispatchLoop();

            var taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
            var currentResult = await taskToWaitFor;

            while (currentResult.AdditionalInfoType != ResultAdditionalInfoTypes.SetResult)
            {
                switch (currentResult.AdditionalInfoType)
                {
                case ResultAdditionalInfoTypes.SaveContext:
                    await Immortal.SaveTaskContextAsync();

                    taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
                    break;

                case ResultAdditionalInfoTypes.TakeCheckpoint:
                    var sequenceNumber = await Immortal.TakeTaskCheckpointAsync();

                    Immortal.StartDispatchLoop();
                    taskToWaitFor = Immortal.GetTaskToWaitForWithAdditionalInfoAsync(sequenceNumber);
                    break;
                }

                currentResult = await taskToWaitFor;
            }

            lock (Immortal.DispatchTaskIdQueueLock)
            {
                Immortal.DispatchTaskIdQueue.Data.Enqueue(taskId);
            }
            return((Boolean)currentResult.Result);
        }
 IXamarinSampleCommProxy.DetAddItemAsync(CommInterfaceClasses.Item p_0)
 {
     return(await DetAddItemAsync(p_0));
 }