jfly / libtnoodle

NOTHING IN HERE IS SANCTIONED BY THE WCA. THIS MUST NOT BE USED FOR OFFICIAL WCA COMPETITIONS.
GNU General Public License v3.0
0 stars 0 forks source link

Thread safety #3

Open jfly opened 10 years ago

jfly commented 10 years ago

This looks like it's going to be tricky. I think OS X and Linux support pthreads, but Windows is a different beast.

I think we should keep this platform specific logic outside of the individual puzzle implementations, and instead give Puzzles a thread safe initialize method for initing pruning tables and whatnot.

Or for now we could require that Puzzles do all their initialization at library load time.

jfly commented 10 years ago

Nevermind, C++ to the rescue! See http://stackoverflow.com/a/2561535 and http://www.cplusplus.com/reference/mutex/