| OLD | NEW |
| 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_ |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // that the default stack size should be used. Upon success, | 58 // that the default stack size should be used. Upon success, |
| 59 // |*thread_handle| will be assigned a handle to the newly created thread, | 59 // |*thread_handle| will be assigned a handle to the newly created thread, |
| 60 // and |delegate|'s ThreadMain method will be executed on the newly created | 60 // and |delegate|'s ThreadMain method will be executed on the newly created |
| 61 // thread. | 61 // thread. |
| 62 // NOTE: When you are done with the thread handle, you must call Join to | 62 // NOTE: When you are done with the thread handle, you must call Join to |
| 63 // release system resources associated with the thread. You must ensure that | 63 // release system resources associated with the thread. You must ensure that |
| 64 // the Delegate object outlives the thread. | 64 // the Delegate object outlives the thread. |
| 65 static bool Create(size_t stack_size, Delegate* delegate, | 65 static bool Create(size_t stack_size, Delegate* delegate, |
| 66 PlatformThreadHandle* thread_handle); | 66 PlatformThreadHandle* thread_handle); |
| 67 | 67 |
| 68 // CreateNonJoinable() does the same thing as Create() except the thread |
| 69 // cannot be Join()'d. Therefore, it also does not output a |
| 70 // PlatformThreadHandle. |
| 71 static bool CreateNonJoinable(size_t stack_size, Delegate* delegate); |
| 72 |
| 68 // 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 |
| 69 // the caller until the designated thread exits. This will invalidate | 74 // the caller until the designated thread exits. This will invalidate |
| 70 // |thread_handle|. | 75 // |thread_handle|. |
| 71 static void Join(PlatformThreadHandle thread_handle); | 76 static void Join(PlatformThreadHandle thread_handle); |
| 72 | 77 |
| 73 private: | 78 private: |
| 74 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); | 79 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); |
| 75 }; | 80 }; |
| 76 | 81 |
| 77 #endif // BASE_PLATFORM_THREAD_H_ | 82 #endif // BASE_PLATFORM_THREAD_H_ |
| 78 | |
| OLD | NEW |