示例#1
0
 // The GRPC service will use this to enqueue and notify the main
 // loop of new incoming work.
 private void EnqueueWorkload(IRenderServerWorkload workload)
 {
     lock (queue_) {
         queue_.Enqueue(workload);
         Monitor.Pulse(queue_);
     }
 }
示例#2
0
 private void ProcessCurrentWorkload()
 {
     current_workload_.ProcessWorkload();
     if (current_workload_.WorkloadDone())
     {
         current_workload_ = null;
     }
 }
示例#3
0
 // The RenderServer is a ImageBatchConsumer, when the Recorder is done
 // it will send a batch here. Pass it to the current workload if it is
 // a ImageBatchConsumer too.
 public void ConsumeImageBatch(RenderBatch batch)
 {
     if (current_workload_ != null && current_workload_ is IImageBatchConsumer)
     {
         (current_workload_ as IImageBatchConsumer).ConsumeImageBatch(batch);
         if (current_workload_.WorkloadDone())
         {
             current_workload_ = null;
         }
     }
     else
     {
         Logger.Warning("RenderServer::ConsumeImageBatch::Unexpected image batch consume call.");
     }
 }
示例#4
0
 // Main server loop. Process current workload, or if it is done
 // try to get a next one.
 public void ProcessRequests()
 {
     if (current_workload_ != null)
     {
         ProcessCurrentWorkload();
     }
     else
     {
         IRenderServerWorkload next_workload = GetNextWorkload();
         if (next_workload != null)
         {
             InitializeNewWorkload(next_workload);
             ProcessCurrentWorkload();
         }
     }
 }
示例#5
0
 private void InitializeNewWorkload(IRenderServerWorkload new_workload)
 {
     current_workload_ = new_workload;
     current_workload_.InitializeWorkload();
 }