{"id":757,"date":"2006-11-02T21:54:50","date_gmt":"2006-11-02T11:54:50","guid":{"rendered":"http:\/\/www.flamingspork.com\/blog\/2006\/11\/02\/my-all-time-favourite-c-class\/"},"modified":"2009-02-21T13:53:57","modified_gmt":"2009-02-21T03:53:57","slug":"my-all-time-favourite-c-class","status":"publish","type":"post","link":"https:\/\/www.flamingspork.com\/blog\/2006\/11\/02\/my-all-time-favourite-c-class\/","title":{"rendered":"My all time favourite C++ Class"},"content":{"rendered":"<pre>class Guard {\r\npublic:\r\nGuard(NdbMutex *mtx) : m_mtx(mtx) { NdbMutex_Lock(m_mtx); };\r\nGuard(NdbLockable &amp; l) : m_mtx(l.m_mutex) { NdbMutex_Lock(m_mtx);\r\n};\r\n~Guard() { NdbMutex_Unlock(m_mtx); };\r\nprivate:\r\nNdbMutex *m_mtx;\r\n};<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>class Guard { public: Guard(NdbMutex *mtx) : m_mtx(mtx) { NdbMutex_Lock(m_mtx); }; Guard(NdbLockable &amp; l) : m_mtx(l.m_mutex) { NdbMutex_Lock(m_mtx); }; ~Guard() { NdbMutex_Unlock(m_mtx); }; private: NdbMutex *m_mtx; };<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[14],"tags":[138,633,139,628],"class_list":["post-757","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-c","tag-code","tag-mutex","tag-mysql"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5a6n8-cd","jetpack-related-posts":[{"id":712,"url":"https:\/\/www.flamingspork.com\/blog\/2006\/06\/09\/matt-on-ruby-resource-management-and-why-you-can-do-it-elsewhere\/","url_meta":{"origin":757,"position":0},"title":"Matt on Ruby resource management (and why you can do it elsewhere)","author":"Stewart Smith","date":"2006-06-09","format":false,"excerpt":"ERROR: The requested URL could not be retrieved (yeah, site didn't work when i clicked on it from RSS). Matt uses this bit of ruby code to demonstrate that here you can't ever not close the file handle: File.open('something.txt') do |fd| # Manipulate the file through 'fd' end # File\u2026","rel":"","context":"In &quot;General&quot;","block_context":{"text":"General","link":"https:\/\/www.flamingspork.com\/blog\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3345,"url":"https:\/\/www.flamingspork.com\/blog\/2013\/05\/23\/mysql-vs-drizzle-plugin-api\/","url_meta":{"origin":757,"position":1},"title":"MySQL vs Drizzle plugin APIs","author":"Stewart Smith","date":"2013-05-23","format":false,"excerpt":"There's a big difference in how plugins are treated in MySQL and how they are treated in Drizzle. The MySQL way has been to create a C API in front of the C++-like (I call it C- as it manages to take the worst of both worlds) internal \"API\". The\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3235,"url":"https:\/\/www.flamingspork.com\/blog\/2013\/03\/05\/mysql-code-size\/","url_meta":{"origin":757,"position":2},"title":"MySQL code size over releases","author":"Stewart Smith","date":"2013-03-05","format":false,"excerpt":"As the start of a bit of a delve into the various MySQL branches and patch sets that have been around, let's start looking at the history of MySQL itself. This is how big MySQL has been over all of the major releases since the beginning (where beginning=3.23). (edit: These\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"increase in MySQL source code size over version","src":"https:\/\/docs.google.com\/spreadsheet\/oimg?key=0Ar7e3-N2Y32IdHFGRWI2ODk4ZUY4TkhrclJSVC1mb3c&oid=1&zx=5h67vlc175bd","width":350,"height":200,"srcset":"https:\/\/docs.google.com\/spreadsheet\/oimg?key=0Ar7e3-N2Y32IdHFGRWI2ODk4ZUY4TkhrclJSVC1mb3c&oid=1&zx=5h67vlc175bd 1x, https:\/\/docs.google.com\/spreadsheet\/oimg?key=0Ar7e3-N2Y32IdHFGRWI2ODk4ZUY4TkhrclJSVC1mb3c&oid=1&zx=5h67vlc175bd 1.5x"},"classes":[]},{"id":3242,"url":"https:\/\/www.flamingspork.com\/blog\/2013\/03\/07\/other-mysql-code-size\/","url_meta":{"origin":757,"position":3},"title":"Other MySQL branch code sizes\u00ef\u00bb\u00bf\u00ef\u00bb\u00bf","author":"Stewart Smith","date":"2013-03-07","format":false,"excerpt":"Continuing on from my previous posts,\u00c2\u00a0MySQL code size over releases\u00c2\u00a0and\u00c2\u00a0MariaDB code size\u00c2\u00a0I've decided to also look into some other code branches. I've used the same methodology as my previous few posts: sloccount for C and C++ code only. There are also other branches around in pretty widespread use (if only\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3238,"url":"https:\/\/www.flamingspork.com\/blog\/2013\/03\/06\/mariadb-code-size\/","url_meta":{"origin":757,"position":4},"title":"MariaDB code size","author":"Stewart Smith","date":"2013-03-06","format":false,"excerpt":"Continuing on from my previous post,\u00c2\u00a0MySQL code size over releases. I wanted to look at the different branches\/patch sets of MySQL out there and work out how far from upstream they deviated. I'm just going to compare against whatever upstream version the most easily accessible version is based on (be\u2026","rel":"","context":"In &quot;General&quot;","block_context":{"text":"General","link":"https:\/\/www.flamingspork.com\/blog\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/docs.google.com\/spreadsheet\/oimg?key=0Ar7e3-N2Y32IdHFGRWI2ODk4ZUY4TkhrclJSVC1mb3c&oid=4&zx=imt1yst694nh","width":350,"height":200},"classes":[]},{"id":562,"url":"https:\/\/www.flamingspork.com\/blog\/2006\/01\/20\/mysql-can-mysql-be-run-from-a-cdrom\/","url_meta":{"origin":757,"position":5},"title":"MySQL: Can MySQL be run from a CDROM?","author":"Stewart Smith","date":"2006-01-20","format":false,"excerpt":"MySQL: Can MySQL be run from a CDROM? The question is asked. The answer is - yes! Temporary tables can be store anywhere - e.g. the system's temporary directory (\/tmp on unix, probably c:\\temp or something on windows... i'm sure there's one of those %FOO% things for it). IIRC you\u2026","rel":"","context":"In &quot;mysql&quot;","block_context":{"text":"mysql","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/757","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/comments?post=757"}],"version-history":[{"count":2,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/757\/revisions"}],"predecessor-version":[{"id":1531,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/757\/revisions\/1531"}],"wp:attachment":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/media?parent=757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/categories?post=757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/tags?post=757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}