Borrar filtros
Borrar filtros

Killing a (mex) Function When It Doesn't Respond to Ctrl-C or Ctrl-Break Under WIN64

20 visualizaciones (últimos 30 días)
Is there a way to kill a (mex) function running in MATLAB and which doesn't respond to Ctrl-C or CTrl-Break, other than by killing the whole MATLAB process (session)? To be concrete, assume R2014A WIN 64.
Thanks.

Respuesta aceptada

Jan
Jan el 1 de Jun. de 2015
Editada: James Tursa el 6 de Oct. de 2017
No, you have to kill the Matlab process.

Más respuestas (2)

Peter Lawrence
Peter Lawrence el 6 de Oct. de 2017
Editada: Walter Roberson el 6 de Oct. de 2017
Yes, it's part of the "undocumented" matlab stuff, but at least it works, and works well.
and/or
  1 comentario
Mark Stone
Mark Stone el 6 de Oct. de 2017
Nice. This addresses coding of a mex file so that it can be interrupted. However, it does not address the interruptibility of a mex file provided without source code. So if I understand correctly, I would still be out of luck if trying to run a mex file which was not designed to be interrupted and for which I don't have access to source code.

Iniciar sesión para comentar.


Victor
Victor el 16 de Jun. de 2016

Who accepted that unacceptable answer!?

No but seriously this is sooooooooooooooooooooooooooooooooooooooooo annoying!

  4 comentarios
James Tursa
James Tursa el 8 de Feb. de 2019
Editada: James Tursa el 8 de Feb. de 2019
Huh? OP asked about a mex function that specifically does NOT respond to Ctrl-C or the like. He makes that very clear in his response to Peter that he is interested in interrupting compiled mex routines that have no special coding to respond to Ctrl-C. Jan's answer is correct for the question asked.
Peter's response is definitely valuable and related to the question, but it requires recoding and recompiling the mex routine, something the OP specifically points out was not the intent of his original question. Plus, it is not clear to me what would happen in that 2nd link if the MATLAB Memory Manager was interrupted in the middle of something when its Worker Thread got terminated. I haven't inestigated this, but I can easily envision a crash scenario.
Both responses deservedly got reputation points. I don't think there is anything to complain about here ...
Pavel Holoborodko
Pavel Holoborodko el 23 de En. de 2020
@"Plus, it is not clear to me what would happen in that 2nd link if the MATLAB Memory Manager was interrupted in the middle of something when its Worker Thread got terminated."
Suggestions to the situation are provided in the post. In short, WorkerThread must be used for computations, not for memory allocations (especially not by MATLAB Memory Manager functions). It is really bad idea to mix allocations & computations in (any) numerical code anyway.

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by