Skip to content

Commit

Permalink
[PrematureStopping] Remove sg_global_cancel_computation.
Browse files Browse the repository at this point in the history
  • Loading branch information
geektoni authored and vigsterkr committed Jul 8, 2017
1 parent 25a4732 commit f390c72
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 83 deletions.
4 changes: 0 additions & 4 deletions src/interfaces/csharp/sg_print_functions.cpp
Expand Up @@ -15,7 +15,3 @@ void sg_global_print_error(FILE* target, const char* str)
{
fprintf(target, "%s", str);
}

void sg_global_cancel_computations(bool& delayed, bool& immediately)
{
}
4 changes: 0 additions & 4 deletions src/interfaces/java/sg_print_functions.cpp
Expand Up @@ -15,7 +15,3 @@ void sg_global_print_error(FILE* target, const char* str)
{
fprintf(target, "%s", str);
}

void sg_global_cancel_computations(bool& delayed, bool& immediately)
{
}
4 changes: 0 additions & 4 deletions src/interfaces/lua/sg_print_functions.cpp
Expand Up @@ -15,7 +15,3 @@ void sg_global_print_error(FILE* target, const char* str)
{
fprintf(target, "%s", str);
}

void sg_global_cancel_computations(bool& delayed, bool& immediately)
{
}
4 changes: 0 additions & 4 deletions src/interfaces/octave/sg_print_functions.cpp
Expand Up @@ -29,7 +29,3 @@ void sg_global_print_error(FILE* target, const char* str)
{
fprintf(target, "%s", str);
}

void sg_global_cancel_computations(bool& delayed, bool& immediately)
{
}
29 changes: 0 additions & 29 deletions src/interfaces/perl/sg_print_functions.cpp
Expand Up @@ -40,32 +40,3 @@ void sg_global_print_error(FILE* target, const char* str)
else
fprintf(target, "%s", str);
}

// PTZ121009 used in threads...so cannot access stdin like this...
// why not checking kill stuff???
void sg_global_cancel_computations(bool& delayed, bool& immediately)
{
#if 0
using namespace shogun;

dTHX; /* fetch context */
//PerlIO_init(pTHX);
// PerlIO *f = PerlIO_stdin(); crashes in Perl_csighandler () from /usr/lib/libperl.so.5.14

if(!f) {return;}
if(PerlIO_flush(f)) //check signal
{
SG_SPRINT("\nImmediately return to matlab prompt / Prematurely finish computations / Do nothing (I/P/D)? ");
char answer= PerlIO_getc(f);
if (answer == 'I')
immediately=true;
else if (answer == 'P')
{
PerlIO_clearerr(f);
delayed=true;
}
else
SG_SPRINT("\n");
}
#endif
}
25 changes: 0 additions & 25 deletions src/interfaces/python/sg_print_functions.cpp
Expand Up @@ -34,28 +34,3 @@ void sg_global_print_error(FILE* target, const char* str)
else
fprintf(target, "%s", str);
}

void sg_global_cancel_computations(bool& delayed, bool& immediately)
{
using namespace shogun;

PyGILState_STATE gil = PyGILState_Ensure();
if (PyErr_CheckSignals())
{
SG_SPRINT(
"\nImmediately return to prompt / Prematurely finish "
"computations / Do nothing (I/P/D)? ");
char answer = fgetc(stdin);

if (answer == 'I')
immediately = true;
else if (answer == 'P')
{
PyErr_Clear();
delayed = true;
}
else
SG_SPRINT("\n");
}
PyGILState_Release(gil);
}
5 changes: 0 additions & 5 deletions src/interfaces/r/sg_print_functions.cpp
Expand Up @@ -32,8 +32,3 @@ void sg_global_print_error(FILE* target, const char* str)
else
fprintf(target, "%s", str);
}

void sg_global_cancel_computations(bool& delayed, bool& immediately)
{
/* R_Suicide((char*) "sg stopped by SIGINT\n"); */
}
4 changes: 0 additions & 4 deletions src/interfaces/ruby/sg_print_functions.cpp
Expand Up @@ -15,7 +15,3 @@ void sg_global_print_error(FILE* target, const char* str)
{
fprintf(target, "%s", str);
}

void sg_global_cancel_computations(bool& delayed, bool& immediately)
{
}
5 changes: 1 addition & 4 deletions src/interfaces/swig/SGBase.i
Expand Up @@ -111,9 +111,6 @@ public void readExternal(java.io.ObjectInput in) throws java.io.IOException, jav
extern void sg_global_print_message(FILE* target, const char* str);
extern void sg_global_print_warning(FILE* target, const char* str);
extern void sg_global_print_error(FILE* target, const char* str);
#ifndef DISABLE_CANCEL_CALLBACK
extern void sg_global_cancel_computations(bool &delayed, bool &immediately);
#endif

#ifdef SWIGR
#include <Rdefines.h>
Expand Down Expand Up @@ -162,7 +159,7 @@ public void readExternal(java.io.ObjectInput in) throws java.io.IOException, jav
#if !defined(SWIGJAVA) && !defined(SWIGCSHARP)
#ifndef DISABLE_CANCEL_CALLBACK
shogun::init_shogun(&sg_global_print_message, &sg_global_print_warning,
&sg_global_print_error, &sg_global_cancel_computations);
&sg_global_print_error);
#else
shogun::init_shogun(&sg_global_print_message, &sg_global_print_warning,
&sg_global_print_error);
Expand Down

0 comments on commit f390c72

Please sign in to comment.