OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // A semaphore object is a synchronization object that maintains a count. The | 403 // A semaphore object is a synchronization object that maintains a count. The |
404 // count is decremented each time a thread completes a wait for the semaphore | 404 // count is decremented each time a thread completes a wait for the semaphore |
405 // object and incremented each time a thread signals the semaphore. When the | 405 // object and incremented each time a thread signals the semaphore. When the |
406 // count reaches zero, threads waiting for the semaphore blocks until the | 406 // count reaches zero, threads waiting for the semaphore blocks until the |
407 // count becomes non-zero. | 407 // count becomes non-zero. |
408 | 408 |
409 class Semaphore { | 409 class Semaphore { |
410 public: | 410 public: |
411 virtual ~Semaphore() {} | 411 virtual ~Semaphore() {} |
412 | 412 |
413 // Suspends the calling thread until the counter is non zero | 413 // Suspends the calling thread until the semaphore counter is non zero |
414 // and then decrements the semaphore counter. | 414 // and then decrements the semaphore counter. |
415 virtual void Wait() = 0; | 415 virtual void Wait() = 0; |
416 | 416 |
| 417 // Suspends the calling thread until the counter is non zero or the timeout |
| 418 // time has passsed. If timeout happens the return value is false and the |
| 419 // counter is unchanged. Otherwise the semaphore counter is decremented and |
| 420 // true is returned. The timeout value is specified in microseconds. |
| 421 virtual bool Wait(int timeout) = 0; |
| 422 |
417 // Increments the semaphore counter. | 423 // Increments the semaphore counter. |
418 virtual void Signal() = 0; | 424 virtual void Signal() = 0; |
419 }; | 425 }; |
420 | 426 |
421 | 427 |
422 // ---------------------------------------------------------------------------- | 428 // ---------------------------------------------------------------------------- |
423 // Socket | 429 // Socket |
424 // | 430 // |
425 | 431 |
426 class Socket { | 432 class Socket { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 bool active_; | 504 bool active_; |
499 PlatformData* data_; // Platform specific data. | 505 PlatformData* data_; // Platform specific data. |
500 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 506 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
501 }; | 507 }; |
502 | 508 |
503 #endif // ENABLE_LOGGING_AND_PROFILING | 509 #endif // ENABLE_LOGGING_AND_PROFILING |
504 | 510 |
505 } } // namespace v8::internal | 511 } } // namespace v8::internal |
506 | 512 |
507 #endif // V8_PLATFORM_H_ | 513 #endif // V8_PLATFORM_H_ |
OLD | NEW |