-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate dispatch2 from https://github.com/marysaka/dispatch2
Part of #77.
- Loading branch information
Showing
10 changed files
with
1,597 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
name = "dispatch2" | ||
version = "0.1.0" | ||
authors = ["Mary <[email protected]>"] | ||
license = "Apache-2.0 OR MIT" | ||
repository = "https://www.github.com/marysaka/dispatch2.git" | ||
homepage = "https://www.github.com/marysaka/dispatch2" | ||
description = "Bindings and wrappers for the Grand Central Dispatch (GCD)" | ||
keywords = ["gcd", "macOS", "iOS", "watchOS", "ipadOS"] | ||
categories = ["api-bindings", "development-tools::ffi", "os::macos-apis"] | ||
edition = "2021" | ||
|
||
exclude = [ | ||
".github" | ||
] | ||
|
||
[dependencies] | ||
libc = "0.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# dispatch2 | ||
|
||
Allows interaction with the [Apple Dispatch](https://developer.apple.com/documentation/dispatch) library in a safe and unsafe way. | ||
|
||
## Usage | ||
|
||
To use `dispatch2`, add this to your `Cargo.toml`: | ||
|
||
```toml | ||
[dependencies] | ||
dispatch2 = "0.1.0" | ||
``` | ||
|
||
## Example | ||
|
||
```rust | ||
use dispatch2::{Queue, QueueAttribute}; | ||
|
||
fn main() { | ||
let queue = Queue::new("example_queue", QueueAttribute::Serial); | ||
queue.exec_async(|| println!("Hello")); | ||
queue.exec_sync(|| println!("World")); | ||
} | ||
``` | ||
|
||
## License | ||
|
||
dispatch2 is distributed under the terms of either the MIT license or the Apache | ||
License (Version 2.0), at the user's choice. | ||
|
||
See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# TODO | ||
|
||
- Fully document all ffi APIs | ||
- CI test on macOS | ||
- CI test on Linux using https://github.com/apple/swift-corelibs-libdispatch | ||
- CI test on Windows using https://github.com/apple/swift-corelibs-libdispatch | ||
- Safe wrapper for ``dispatch_source_*`` + ``set_target_queue/activate/suspend/resume`` for it | ||
- Safe wrapper for ``dispatch_data_*`` | ||
- Safe wrapper for ``dispatch_once_f`` (is that relevent?) | ||
- Safe wrapper for ``dispatch_get_context/dispatch_set_context`` (quite impossible without big overhead => wrap dispatch object destructor to release the boxed value) | ||
- All blocks related bindings and ``dispatch_block_*`` functions with compat with ``block2`` on Apple platforms. | ||
- Integrate conversion from SystemTime to dispatch_time_t via dispatch_walltime and safe APIs using that. |
Oops, something went wrong.