Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
64c7e966
Commit
64c7e966
authored
Feb 02, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a function to check if the matlab user hit ctrl+c.
parent
c35041e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
call_matlab.h
dlib/matlab/call_matlab.h
+8
-0
mex_wrapper.cpp
dlib/matlab/mex_wrapper.cpp
+14
-0
No files found.
dlib/matlab/call_matlab.h
View file @
64c7e966
...
...
@@ -8,6 +8,14 @@
// ----------------------------------------------------------------------------------------
void
check_for_ctrl_c
();
/*!
ensures
- If the user of MATLAB has pressed ctrl+c then this function will throw an
exception.
!*/
// ----------------------------------------------------------------------------------------
class
matlab_struct
{
...
...
dlib/matlab/mex_wrapper.cpp
View file @
64c7e966
...
...
@@ -253,6 +253,8 @@ namespace mex_binding
// -------------------------------------------------------
struct
user_hit_ctrl_c
{};
struct
invalid_args_exception
{
invalid_args_exception
(
const
std
::
string
&
msg_
)
:
msg
(
msg_
)
{}
...
...
@@ -1573,6 +1575,10 @@ namespace mex_binding
mexErrMsgIdAndTxt
(
"mex_function:validate_and_populate_arg"
,
(
"Input"
+
e
.
msg
).
c_str
());
}
catch
(
user_hit_ctrl_c
&
)
{
// do nothing, just return to matlab
}
catch
(
dlib
::
error
&
e
)
{
mexErrMsgIdAndTxt
(
"mex_function:error"
,
...
...
@@ -2371,6 +2377,14 @@ void call_matlab (
call_matlab
(
"feval"
,
funct
);
}
extern
"C"
bool
utIsInterruptPending
();
void
check_for_ctrl_c
(
)
{
if
(
utIsInterruptPending
())
throw
mex_binding
::
user_hit_ctrl_c
();
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
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