Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Forums
  - IRC
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# core.sync.condition

The `condition` module provides a primitive for synchronized `condition` checking.
License:
Boost License 1.0
Authors:
Sean Kelly

Source core/sync/condition.d

class `Condition`;
  This class represents a condition variable as conceived by C.A.R. Hoare. As per Mesa type monitors however, "signal" has been replaced with "notify" to indicate that control is not transferred to the waiter when a notification is sent.
  nothrow @safe this(Mutex `m`);
    Initializes a condition object which is associated with the supplied mutex object.
    Parameters:

    Mutex `m` | The mutex with which this condition will be associated.

    Throws:
    SyncError on error.
  @property Mutex `mutex`();
    Gets the `mutex` associated with this condition.
    Returns:
    The `mutex` associated with this condition.
  void `wait`();
    Wait until notified.
    Throws:
    SyncError on error.
  bool `wait`(Duration `val`);
    Suspends the calling thread until a notification occurs or until the supplied time period has elapsed.
    Parameters:

    Duration `val` | The time to `wait`.

    In `val` must be non-negative.

    Throws:
    SyncError on error.
    Returns:
    `true` if notified before the timeout and `false` if not.
  void `notify`();
    Notifies one waiter.
    Throws:
    SyncError on error.
  void `notifyAll`();
    Notifies all waiters.
    Throws:
    SyncError on error.

Copyright © 1999-2018 by the D Language Foundation | Page generated by Ddoc on Sat Apr 14 16:39:10 2018