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

Side by Side Diff: base/platform_thread.h

Issue 118469: compile on openbsd: mostly ifdefs and missing includes,... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // WARNING: You should *NOT* be using this class directly. PlatformThread is 5 // WARNING: You should *NOT* be using this class directly. PlatformThread is
6 // the low-level platform-specific abstraction to the OS's threading interface. 6 // the low-level platform-specific abstraction to the OS's threading interface.
7 // You should instead be using a message-loop driven Thread, see thread.h. 7 // You should instead be using a message-loop driven Thread, see thread.h.
8 8
9 #ifndef BASE_PLATFORM_THREAD_H_ 9 #ifndef BASE_PLATFORM_THREAD_H_
10 #define BASE_PLATFORM_THREAD_H_ 10 #define BASE_PLATFORM_THREAD_H_
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 13
14 // PlatformThreadHandle should not be assumed to be a numeric type, since the 14 // PlatformThreadHandle should not be assumed to be a numeric type, since the
15 // standard intends to allow pthread_t to be a structure. This means you 15 // standard intends to allow pthread_t to be a structure. This means you
16 // should not initialize it to a value, like 0. If it's a member variable, the 16 // should not initialize it to a value, like 0. If it's a member variable, the
17 // constructor can safely "value initialize" using () in the initializer list. 17 // constructor can safely "value initialize" using () in the initializer list.
18 #if defined(OS_WIN) 18 #if defined(OS_WIN)
19 #include <windows.h> 19 #include <windows.h>
20 typedef DWORD PlatformThreadId; 20 typedef DWORD PlatformThreadId;
21 typedef void* PlatformThreadHandle; // HANDLE 21 typedef void* PlatformThreadHandle; // HANDLE
22 #elif defined(OS_POSIX) 22 #elif defined(OS_POSIX)
23 #include <pthread.h> 23 #include <pthread.h>
24 typedef pthread_t PlatformThreadHandle; 24 typedef pthread_t PlatformThreadHandle;
25 #if defined(OS_LINUX) 25 #if defined(OS_LINUX) || defined(OS_OPENBSD)
26 #include <unistd.h> 26 #include <unistd.h>
27 typedef pid_t PlatformThreadId; 27 typedef pid_t PlatformThreadId;
28 #elif defined(OS_MACOSX) 28 #elif defined(OS_MACOSX)
29 #include <mach/mach.h> 29 #include <mach/mach.h>
30 typedef mach_port_t PlatformThreadId; 30 typedef mach_port_t PlatformThreadId;
31 #endif 31 #endif
32 #endif 32 #endif
33 33
34 // A namespace for low-level thread functions. 34 // A namespace for low-level thread functions.
35 class PlatformThread { 35 class PlatformThread {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // Joins with a thread created via the Create function. This function blocks 73 // Joins with a thread created via the Create function. This function blocks
74 // the caller until the designated thread exits. This will invalidate 74 // the caller until the designated thread exits. This will invalidate
75 // |thread_handle|. 75 // |thread_handle|.
76 static void Join(PlatformThreadHandle thread_handle); 76 static void Join(PlatformThreadHandle thread_handle);
77 77
78 private: 78 private:
79 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); 79 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread);
80 }; 80 };
81 81
82 #endif // BASE_PLATFORM_THREAD_H_ 82 #endif // BASE_PLATFORM_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698