MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / Compressor

Class Compressor

server/VGLTrans.h:70–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 rrversion version;
69
70 class Compressor : public util::Runnable
71 {
72 public:
73
74 Compressor(int myRank_, VGLTrans *parent_) : bytes(0),
75 storedFrames(0), cframes(NULL), frame(NULL), lastFrame(NULL),
76 myRank(myRank_), deadYet(false), parent(parent_)
77 {
78 if(parent) nprocs = parent->nprocs;
79 ready.wait(); complete.wait();
80 char temps[20];
81 snprintf(temps, 20, "Compress %d", myRank);
82 profComp.setName(temps);
83 #ifdef USEHELGRIND
84 ANNOTATE_BENIGN_RACE_SIZED(&deadYet, sizeof(bool), );
85 #endif
86 }
87
88 virtual ~Compressor(void)
89 {
90 shutdown();
91 free(cframes); cframes = NULL;
92 }
93
94 void run(void)
95 {
96 while(!deadYet)
97 {
98 try
99 {
100 ready.wait(); if(deadYet) break;
101 compressSend(frame, lastFrame);
102 complete.signal();
103 }
104 catch(...)
105 {
106 complete.signal(); throw;
107 }
108 }
109 }
110
111 void go(common::Frame *frame_, common::Frame *lastFrame_)
112 {
113 frame = frame_; lastFrame = lastFrame_;
114 ready.signal();
115 }
116
117 void stop(void)
118 {
119 complete.wait();
120 }
121
122 void shutdown(void) { deadYet = true; ready.signal(); }
123 void compressSend(common::Frame *frame, common::Frame *lastFrame);
124 void send(void);
125
126 long bytes;
127

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected