MCPcopy Create free account
hub / github.com/davisking/dlib / thread

Method thread

examples/pipe_ex_2.cpp:102–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100 }
101
102 void thread ()
103 {
104 tsu_type msg;
105
106 // Here we loop on messages from the message_pipe.
107 while (message_pipe.dequeue(msg))
108 {
109 // Here we call the apply_to_contents() function on our type_safe_union.
110 // It takes a function object and applies that function object
111 // to the contents of the union. In our case we have setup
112 // the pipe_example class as our function object and so below we
113 // tell the msg object to take whatever it contains and
114 // call (*this)(contained_object); So what happens here is
115 // one of the three above functions gets called with the message
116 // we just got.
117 msg.apply_to_contents(*this);
118 }
119 }
120
121 // Finally, note that since we declared the operator() member functions
122 // private we need to declare the type_safe_union as a friend of this

Callers

nothing calls this directly

Calls 1

apply_to_contentsMethod · 0.80

Tested by

no test coverage detected