| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "Threading.h" | 27 #include "Threading.h" |
| 28 #include <wtf/OwnPtr.h> | 28 #include <wtf/OwnPtr.h> |
| 29 #include <wtf/PassOwnPtr.h> | 29 #include <wtf/PassOwnPtr.h> |
| 30 | 30 |
| 31 #include <string.h> | 31 #include <string.h> |
| 32 | 32 |
| 33 namespace WTF { | 33 namespace WTF { |
| 34 | 34 |
| 35 extern void initializeThreading(); |
| 36 |
| 37 void initialize(TimeFunction currentTimeFunction, TimeFunction monotonicallyIncr
easingTimeFunction) |
| 38 { |
| 39 setCurrentTimeFunction(currentTimeFunction); |
| 40 setMonotonicallyIncreasingTimeFunction(monotonicallyIncreasingTimeFunction); |
| 41 initializeThreading(); |
| 42 } |
| 43 |
| 35 struct NewThreadContext { | 44 struct NewThreadContext { |
| 36 WTF_MAKE_FAST_ALLOCATED; | 45 WTF_MAKE_FAST_ALLOCATED; |
| 37 public: | 46 public: |
| 38 NewThreadContext(ThreadFunction entryPoint, void* data, const char* name) | 47 NewThreadContext(ThreadFunction entryPoint, void* data, const char* name) |
| 39 : entryPoint(entryPoint) | 48 : entryPoint(entryPoint) |
| 40 , data(data) | 49 , data(data) |
| 41 , name(name) | 50 , name(name) |
| 42 { | 51 { |
| 43 } | 52 } |
| 44 | 53 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 89 |
| 81 NewThreadContext* context = new NewThreadContext(entryPoint, data, name); | 90 NewThreadContext* context = new NewThreadContext(entryPoint, data, name); |
| 82 | 91 |
| 83 // Prevent the thread body from executing until we've established the thread
identifier. | 92 // Prevent the thread body from executing until we've established the thread
identifier. |
| 84 MutexLocker locker(context->creationMutex); | 93 MutexLocker locker(context->creationMutex); |
| 85 | 94 |
| 86 return createThreadInternal(threadEntryPoint, context, name); | 95 return createThreadInternal(threadEntryPoint, context, name); |
| 87 } | 96 } |
| 88 | 97 |
| 89 } // namespace WTF | 98 } // namespace WTF |
| OLD | NEW |