small medium large xlarge

Generic-user-small
27 Apr 2017, 02:39
Prakash (1 post)

Hi Jeff,

I really like your book, and still refer it to this day ( after 2 yrs buying it).

I am using your threadpool program and adding some features to it. It has been a good learning exercise.

I have one question - Why did you create threads with shared_ptr instead of unique_ptr?

Jefflangr_pragsmall
27 Apr 2017, 15:22
Jeff Langr (24 posts)

Greetings Prakash–

Thanks for the feedback, and I’m glad to hear you’re getting solid use out of the book still.

I looked at the code and cannot recall the reason–probably not a good one, and likely just (bad) habit of resorting to something comfortable. It should work either way, tho it seems like unique_ptr would sound better here. This is the beauty of unit tests–try it out and see what happens.

Regards, Jeff

You must be logged in to comment