"git@developer.sourcefind.cn:OpenDAS/dlib.git" did not exist on "a550e31034ec63a5e5cdb097c342a5e18964ce6e"
Commit c02fd30a authored by Davis King's avatar Davis King
Browse files

Added some comments regarding the use of std::swap.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402816
parent 2299b24d
...@@ -148,7 +148,16 @@ int main() ...@@ -148,7 +148,16 @@ int main()
dlog << LINFO << "Add job " << i << " to pipe"; dlog << LINFO << "Add job " << i << " to pipe";
job j; job j;
j.id = i; j.id = i;
// Add this job to the pipe. One of our three threads will get it and process it
// Add this job to the pipe. One of our three threads will get it and process it.
// It should also be pointed out that the enqueue() function uses the global
// swap function to move jobs into the pipe. This means that it modifies the
// jobs we are passing in to it. This allows you to implement a fast swap
// operator for your jobs. For example, std::vector objects have a global
// swap and it can execute in constant time by just swapping pointers inside
// std::vector. This means that the dlib::pipe is effectively a zero-copy
// message passing system if you setup global swap for your jobs.
pe.job_pipe.enqueue(j); pe.job_pipe.enqueue(j);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment