Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: xz/src/common/mythread.h

Issue 2869016: Add an unpatched version of xz, XZ Utils, to /trunk/deps/third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xz/src/common/common_w32res.rc ('k') | xz/src/common/sysdefs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xz/src/common/mythread.h
===================================================================
--- xz/src/common/mythread.h (revision 0)
+++ xz/src/common/mythread.h (revision 0)
@@ -0,0 +1,42 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file mythread.h
+/// \brief Wrappers for threads
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "sysdefs.h"
+
+
+#ifdef HAVE_PTHREAD
+# include <pthread.h>
+
+# define mythread_once(func) \
+ do { \
+ static pthread_once_t once_ = PTHREAD_ONCE_INIT; \
+ pthread_once(&once_, &func); \
+ } while (0)
+
+# define mythread_sigmask(how, set, oset) \
+ pthread_sigmask(how, set, oset)
+
+#else
+
+# define mythread_once(func) \
+ do { \
+ static bool once_ = false; \
+ if (!once_) { \
+ func(); \
+ once_ = true; \
+ } \
+ } while (0)
+
+# define mythread_sigmask(how, set, oset) \
+ sigprocmask(how, set, oset)
+
+#endif
Property changes on: xz/src/common/mythread.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « xz/src/common/common_w32res.rc ('k') | xz/src/common/sysdefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698