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 3480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3491 * Multiple threads in V8 are allowed, but only one thread at a time | 3491 * Multiple threads in V8 are allowed, but only one thread at a time |
3492 * is allowed to use any given V8 isolate. See Isolate class | 3492 * is allowed to use any given V8 isolate. See Isolate class |
3493 * comments. The definition of 'using V8 isolate' includes | 3493 * comments. The definition of 'using V8 isolate' includes |
3494 * accessing handles or holding onto object pointers obtained | 3494 * accessing handles or holding onto object pointers obtained |
3495 * from V8 handles while in the particular V8 isolate. It is up | 3495 * from V8 handles while in the particular V8 isolate. It is up |
3496 * to the user of V8 to ensure (perhaps with locking) that this | 3496 * to the user of V8 to ensure (perhaps with locking) that this |
3497 * constraint is not violated. | 3497 * constraint is not violated. |
3498 * | 3498 * |
3499 * v8::Locker is a scoped lock object. While it's | 3499 * v8::Locker is a scoped lock object. While it's |
3500 * active (i.e. between its construction and destruction) the current thread is | 3500 * active (i.e. between its construction and destruction) the current thread is |
3501 * allowed to use the locked isolate. V8 guarantees that an isolate can be locke
d | 3501 * allowed to use the locked isolate. V8 guarantees that an isolate can be |
3502 * by at most one thread at any time. In other words, the scope of a v8::Locker
is | 3502 * locked by at most one thread at any time. In other words, the scope of a |
3503 * a critical section. | 3503 * v8::Locker is a critical section. |
3504 * | 3504 * |
3505 * Sample usage: | 3505 * Sample usage: |
3506 * \code | 3506 * \code |
3507 * ... | 3507 * ... |
3508 * { | 3508 * { |
3509 * v8::Locker locker(isolate); | 3509 * v8::Locker locker(isolate); |
3510 * v8::Isolate::Scope isolate_scope(isolate); | 3510 * v8::Isolate::Scope isolate_scope(isolate); |
3511 * ... | 3511 * ... |
3512 * // Code using V8 and isolate goes here. | 3512 * // Code using V8 and isolate goes here. |
3513 * ... | 3513 * ... |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3595 * for the V8 lock. | 3595 * for the V8 lock. |
3596 */ | 3596 */ |
3597 static void StartPreemption(int every_n_ms); | 3597 static void StartPreemption(int every_n_ms); |
3598 | 3598 |
3599 /** | 3599 /** |
3600 * Stop preemption. | 3600 * Stop preemption. |
3601 */ | 3601 */ |
3602 static void StopPreemption(); | 3602 static void StopPreemption(); |
3603 | 3603 |
3604 /** | 3604 /** |
3605 * Returns whether or not the locker for a given isolate, or default isolate i
f NULL is given, | 3605 * Returns whether or not the locker for a given isolate, or default isolate |
3606 * is locked by the current thread. | 3606 * if NULL is given, is locked by the current thread. |
3607 */ | 3607 */ |
3608 static bool IsLocked(Isolate* isolate = NULL); | 3608 static bool IsLocked(Isolate* isolate = NULL); |
3609 | 3609 |
3610 /** | 3610 /** |
3611 * Returns whether v8::Locker is being used by this V8 instance. | 3611 * Returns whether v8::Locker is being used by this V8 instance. |
3612 */ | 3612 */ |
3613 static bool IsActive(); | 3613 static bool IsActive(); |
3614 | 3614 |
3615 private: | 3615 private: |
3616 bool has_lock_; | 3616 bool has_lock_; |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4201 | 4201 |
4202 | 4202 |
4203 } // namespace v8 | 4203 } // namespace v8 |
4204 | 4204 |
4205 | 4205 |
4206 #undef V8EXPORT | 4206 #undef V8EXPORT |
4207 #undef TYPE_CHECK | 4207 #undef TYPE_CHECK |
4208 | 4208 |
4209 | 4209 |
4210 #endif // V8_H_ | 4210 #endif // V8_H_ |
OLD | NEW |