OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3424 * Multiple threads in V8 are allowed, but only one thread at a time | 3424 * Multiple threads in V8 are allowed, but only one thread at a time |
3425 * is allowed to use any given V8 isolate. See Isolate class | 3425 * is allowed to use any given V8 isolate. See Isolate class |
3426 * comments. The definition of 'using V8 isolate' includes | 3426 * comments. The definition of 'using V8 isolate' includes |
3427 * accessing handles or holding onto object pointers obtained | 3427 * accessing handles or holding onto object pointers obtained |
3428 * from V8 handles while in the particular V8 isolate. It is up | 3428 * from V8 handles while in the particular V8 isolate. It is up |
3429 * to the user of V8 to ensure (perhaps with locking) that this | 3429 * to the user of V8 to ensure (perhaps with locking) that this |
3430 * constraint is not violated. | 3430 * constraint is not violated. |
3431 * | 3431 * |
3432 * v8::Locker is a scoped lock object. While it's | 3432 * v8::Locker is a scoped lock object. While it's |
3433 * active (i.e. between its construction and destruction) the current thread is | 3433 * active (i.e. between its construction and destruction) the current thread is |
3434 * allowed to use the locked isolate. V8 guarantees that an isolate can be | 3434 * allowed to use the locked isolate. V8 guarantees that an isolate can be locke
d |
3435 * locked by at most one thread at any time. In other words, the scope of a | 3435 * by at most one thread at any time. In other words, the scope of a v8::Locker
is |
3436 * v8::Locker is a critical section. | 3436 * a critical section. |
3437 * | 3437 * |
3438 * Sample usage: | 3438 * Sample usage: |
3439 * \code | 3439 * \code |
3440 * ... | 3440 * ... |
3441 * { | 3441 * { |
3442 * v8::Locker locker(isolate); | 3442 * v8::Locker locker(isolate); |
3443 * v8::Isolate::Scope isolate_scope(isolate); | 3443 * v8::Isolate::Scope isolate_scope(isolate); |
3444 * ... | 3444 * ... |
3445 * // Code using V8 and isolate goes here. | 3445 * // Code using V8 and isolate goes here. |
3446 * ... | 3446 * ... |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3528 * for the V8 lock. | 3528 * for the V8 lock. |
3529 */ | 3529 */ |
3530 static void StartPreemption(int every_n_ms); | 3530 static void StartPreemption(int every_n_ms); |
3531 | 3531 |
3532 /** | 3532 /** |
3533 * Stop preemption. | 3533 * Stop preemption. |
3534 */ | 3534 */ |
3535 static void StopPreemption(); | 3535 static void StopPreemption(); |
3536 | 3536 |
3537 /** | 3537 /** |
3538 * Returns whether or not the locker for a given isolate, or default isolate | 3538 * Returns whether or not the locker for a given isolate, or default isolate i
f NULL is given, |
3539 * if NULL is given, is locked by the current thread. | 3539 * is locked by the current thread. |
3540 */ | 3540 */ |
3541 static bool IsLocked(Isolate* isolate = NULL); | 3541 static bool IsLocked(Isolate* isolate = NULL); |
3542 | 3542 |
3543 /** | 3543 /** |
3544 * Returns whether v8::Locker is being used by this V8 instance. | 3544 * Returns whether v8::Locker is being used by this V8 instance. |
3545 */ | 3545 */ |
3546 static bool IsActive() { return active_; } | 3546 static bool IsActive() { return active_; } |
3547 | 3547 |
3548 private: | 3548 private: |
3549 bool has_lock_; | 3549 bool has_lock_; |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4115 | 4115 |
4116 | 4116 |
4117 } // namespace v8 | 4117 } // namespace v8 |
4118 | 4118 |
4119 | 4119 |
4120 #undef V8EXPORT | 4120 #undef V8EXPORT |
4121 #undef TYPE_CHECK | 4121 #undef TYPE_CHECK |
4122 | 4122 |
4123 | 4123 |
4124 #endif // V8_H_ | 4124 #endif // V8_H_ |
OLD | NEW |