Skip to content

Thread start and stop revamp#2383

Closed
cypof wants to merge 2 commits intoBVLC:masterfrom
cypof:thread_start_stop
Closed

Thread start and stop revamp#2383
cypof wants to merge 2 commits intoBVLC:masterfrom
cypof:thread_start_stop

Conversation

@cypof
Copy link
Member

@cypof cypof commented Apr 28, 2015

Split off #2367. Now that threads can be waiting on locks or condition variables, it can be necessary to interrupt them to stop the app. This PR makes sure stopping a Caffe thread always calls interrupt before waiting on join. It also provides a method 'must_stop' that can be tested when running in a loop to exit on demand.

Start and stop methods now fail a CHECK instead of returning a boolean error, given that the application doesn't really have a way to recover from this type of error.

@flx42
Copy link
Contributor

flx42 commented Apr 29, 2015

Looks OK, but using CHECK instead of the boolean return value is debatable I think.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should a public method be deleted without being labeled as @deprecated for some time?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's supposed to be implementation details of the thread mechanism used internally, so I would say yes.

cypof added 2 commits May 18, 2015 17:28
- Interrupt the thread before waiting on join
- Provide a method for looping threads to exit on demand
- CHECK if start and stop succeed instead of returning an error
@cypof cypof force-pushed the thread_start_stop branch from f340f38 to 1f987e1 Compare May 19, 2015 00:28
@shelhamer shelhamer mentioned this pull request May 30, 2015
@shelhamer
Copy link
Member

No longer needed with the switch in #4563.

@shelhamer shelhamer closed this Apr 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments