diff options
author | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-22 10:49:15 +0000 |
---|---|---|
committer | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-22 10:49:15 +0000 |
commit | 578c7cc2380e32ca348b940be71f6b5e3e6c3fea (patch) | |
tree | 8e405703d50d2781f91097e3671efcd278926527 /base/platform_thread.h | |
parent | e816b3e0b4f97d8c0517cb277b265e07c1978f4f (diff) | |
download | chromium_src-578c7cc2380e32ca348b940be71f6b5e3e6c3fea.zip chromium_src-578c7cc2380e32ca348b940be71f6b5e3e6c3fea.tar.gz chromium_src-578c7cc2380e32ca348b940be71f6b5e3e6c3fea.tar.bz2 |
Create a simple abstraction to a native OS thread, mostly useful for unittesting when you don't want a message loop.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1217 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/platform_thread.h')
-rw-r--r-- | base/platform_thread.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/base/platform_thread.h b/base/platform_thread.h index 1274f0f..542716b 100644 --- a/base/platform_thread.h +++ b/base/platform_thread.h @@ -32,6 +32,8 @@ #include "base/basictypes.h" +// PlatformThreadHandle should be a numeric type on all platforms, so it can +// be initialized to 0. However, 0 cannot be assumed to be an invalid handle. #if defined(OS_WIN) typedef void* PlatformThreadHandle; // HANDLE #elif defined(OS_POSIX) @@ -68,14 +70,16 @@ class PlatformThread { // that the default stack size should be used. Upon success, // |*thread_handle| will be assigned a handle to the newly created thread, // and |delegate|'s ThreadMain method will be executed on the newly created - // thread. When you are done with the thread handle, you must call Join to + // thread. + // NOTE: When you are done with the thread handle, you must call Join to // release system resources associated with the thread. You must ensure that // the Delegate object outlives the thread. static bool Create(size_t stack_size, Delegate* delegate, PlatformThreadHandle* thread_handle); // Joins with a thread created via the Create function. This function blocks - // the caller until the designated thread exits. + // the caller until the designated thread exits. This will invalidate + // |thread_handle|. static void Join(PlatformThreadHandle thread_handle); private: |