Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
65130ce7
Commit
65130ce7
authored
Feb 08, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Defer launching daemon threads to improve start-up speed
parent
dac2cc4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
core/src/main/java/com/github/shadowsocks/bg/GuardedProcessPool.kt
...main/java/com/github/shadowsocks/bg/GuardedProcessPool.kt
+4
-5
No files found.
core/src/main/java/com/github/shadowsocks/bg/GuardedProcessPool.kt
View file @
65130ce7
...
@@ -107,15 +107,14 @@ class GuardedProcessPool(private val onFatal: suspend (IOException) -> Unit) : C
...
@@ -107,15 +107,14 @@ class GuardedProcessPool(private val onFatal: suspend (IOException) -> Unit) : C
private
val
job
=
Job
()
private
val
job
=
Job
()
override
val
coroutineContext
get
()
=
Dispatchers
.
Main
+
job
override
val
coroutineContext
get
()
=
Dispatchers
.
Main
+
job
private
val
guards
=
ArrayList
<
Guard
>()
@MainThread
@MainThread
fun
start
(
cmd
:
List
<
String
>,
onRestartCallback
:
(
suspend
()
->
Unit
)?
=
null
)
{
fun
start
(
cmd
:
List
<
String
>,
onRestartCallback
:
(
suspend
()
->
Unit
)?
=
null
)
{
Crashlytics
.
log
(
Log
.
DEBUG
,
TAG
,
"start process: "
+
Commandline
.
toString
(
cmd
))
Crashlytics
.
log
(
Log
.
DEBUG
,
TAG
,
"start process: "
+
Commandline
.
toString
(
cmd
))
val
guard
=
Guard
(
cmd
)
Guard
(
cmd
).
apply
{
guard
.
start
()
start
()
// if start fails, IOException will be thrown directly
guards
+=
guard
launch
{
looper
(
onRestartCallback
)
}
launch
(
start
=
CoroutineStart
.
UNDISPATCHED
)
{
guard
.
looper
(
onRestartCallback
)
}
}
}
}
@MainThread
@MainThread
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment