-
-
Notifications
You must be signed in to change notification settings - Fork 29
Implement native_synchronization within dcli/dcli/lib/src/process/process #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,9 +7,12 @@ import 'dart:convert'; | |
| import 'dart:isolate'; | ||
| import 'dart:typed_data'; | ||
|
|
||
| import 'mailbox.dart'; | ||
| import 'package:native_synchronization/mailbox.dart'; | ||
|
|
||
| import 'message.dart'; | ||
| import 'process_sync.dart'; | ||
| // import 'mailbox.dart'; | ||
| import 'pipe_sync.dart'; | ||
| // import 'process_sync.dart'; | ||
|
|
||
| /// Send and Receive data to/from a process | ||
| /// running in an isolate using a pair of mailboxes. | ||
|
|
@@ -82,12 +85,12 @@ class ProcessChannel { | |
| late final StringConversionSink splitter; | ||
| late final ByteConversionSink decoder; | ||
|
|
||
| // TODO: this probably need to be int arrays so | ||
| // TODO DONE?: this probably need to be int arrays so | ||
| // we can handly binary data. | ||
| final List<List<int>> stdoutLines = <List<int>>[]; | ||
| final List<List<int>> stderrLines = <List<int>>[]; | ||
| int get sendAddress => send.rawAddress; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are no longer necessary. |
||
| int get responseAddress => response.rawAddress; | ||
| // int get sendAddress => send.rawAddress; | ||
| // int get responseAddress => response.rawAddress; | ||
|
|
||
| int? _exitCode; | ||
| int? get exitCode => _exitCode; | ||
|
|
@@ -147,18 +150,17 @@ class ProcessChannel { | |
|
|
||
| /// check the data has been sent to the spawned process | ||
| /// before we return | ||
| final response = send.takeOneMessage(); | ||
| final response = send.take(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Take a single message from main thread. Reference here: https://github.com/dart-lang/native_synchronization/blob/fc4ee3f3b5cdd439ed4c18f2003468ceb24e6458/lib/mailbox.dart#L90 |
||
| if (response.isEmpty || response[0] != RECEIVED) { | ||
| throw ProcessSyncException( | ||
| 'Expecting a write confirmation: got $response'); | ||
| throw ProcessSyncException('Expecting a write confirmation: got $response'); | ||
| } | ||
| } | ||
|
|
||
| void _fetch() { | ||
| Uint8List bytes; | ||
|
|
||
| /// drain the mailbox | ||
| bytes = response.takeOneMessage(); | ||
| bytes = response.take(); | ||
| _recieveFromIsolate(bytes); | ||
| // decoder.add(bytes); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seemed like an used import so I commented it out for now.