@@ -154,17 +154,20 @@ impl Helper {
154
154
. clone ( )
155
155
. into_helper_thread ( move |token| {
156
156
log:: trace!( "Helper thread token sending into channel" ) ;
157
- // We've acquired a token, but we need to not use it as we have our own
158
- // custom release-on-drop struct since we'll want different logic than
159
- // just normally releasing the token in this case.
160
- //
161
- // On unix this unfortunately means that we lose the specific byte that
162
- // was in the pipe (i.e., we just write back the same byte all the time)
163
- // but that's not expected to be a problem.
164
- token. expect ( "acquire token" ) . drop_without_releasing ( ) ;
165
157
if let Some ( sender) = requests2. lock ( ) . unwrap ( ) . pop_front ( ) {
158
+ // We've acquired a token, but we need to not use it as we have our own
159
+ // custom release-on-drop struct since we'll want different logic than
160
+ // just normally releasing the token in this case.
161
+ //
162
+ // On unix this unfortunately means that we lose the specific byte that
163
+ // was in the pipe (i.e., we just write back the same byte all the time)
164
+ // but that's not expected to be a problem.
165
+ token. expect ( "acquire token" ) . drop_without_releasing ( ) ;
166
166
sender ( Acquired :: new ( ) ) ;
167
167
}
168
+
169
+ // If we didn't manage to send the token off, just drop it on
170
+ // the ground; it'll get released automatically.
168
171
} )
169
172
. expect ( "spawned helper" ) ;
170
173
Helper { helper, tokens : 1 , requests }
0 commit comments