OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 } | 373 } |
374 } | 374 } |
375 | 375 |
376 | 376 |
377 // This is the ContextSwitcher singleton. There is at most a single thread | 377 // This is the ContextSwitcher singleton. There is at most a single thread |
378 // running which delivers preemption events to V8 threads. | 378 // running which delivers preemption events to V8 threads. |
379 ContextSwitcher* ContextSwitcher::singleton_ = NULL; | 379 ContextSwitcher* ContextSwitcher::singleton_ = NULL; |
380 | 380 |
381 | 381 |
382 ContextSwitcher::ContextSwitcher(int every_n_ms) | 382 ContextSwitcher::ContextSwitcher(int every_n_ms) |
383 : keep_going_(true), | 383 : |
| 384 #ifdef DEBUG_THREAD_NAMES |
| 385 Thread("v8:CtxtSwitcher"), |
| 386 #endif |
| 387 keep_going_(true), |
384 sleep_ms_(every_n_ms) { | 388 sleep_ms_(every_n_ms) { |
385 } | 389 } |
386 | 390 |
387 | 391 |
388 // Set the scheduling interval of V8 threads. This function starts the | 392 // Set the scheduling interval of V8 threads. This function starts the |
389 // ContextSwitcher thread if needed. | 393 // ContextSwitcher thread if needed. |
390 void ContextSwitcher::StartPreemption(int every_n_ms) { | 394 void ContextSwitcher::StartPreemption(int every_n_ms) { |
391 ASSERT(Locker::IsLocked()); | 395 ASSERT(Locker::IsLocked()); |
392 if (singleton_ == NULL) { | 396 if (singleton_ == NULL) { |
393 // If the ContextSwitcher thread is not running at the moment start it now. | 397 // If the ContextSwitcher thread is not running at the moment start it now. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 // Acknowledge the preemption by the receiving thread. | 434 // Acknowledge the preemption by the receiving thread. |
431 void ContextSwitcher::PreemptionReceived() { | 435 void ContextSwitcher::PreemptionReceived() { |
432 ASSERT(Locker::IsLocked()); | 436 ASSERT(Locker::IsLocked()); |
433 // There is currently no accounting being done for this. But could be in the | 437 // There is currently no accounting being done for this. But could be in the |
434 // future, which is why we leave this in. | 438 // future, which is why we leave this in. |
435 } | 439 } |
436 | 440 |
437 | 441 |
438 } // namespace internal | 442 } // namespace internal |
439 } // namespace v8 | 443 } // namespace v8 |
OLD | NEW |