[rkward-cvs] rkward/rkward/rbackend rcommand.h,1.17,1.18 rinterface.cpp,1.32,1.33 rinterface.h,1.18,1.19 rthread.cpp,1.21,1.22 rthread.h,1.15,1.16
Thomas Friedrichsmeier
tfry at users.sourceforge.net
Thu Oct 13 21:01:59 UTC 2005
- Previous message: [rkward-cvs] rkward/rkward rkglobals.cpp,1.8,1.9 rkglobals.h,1.7,1.8 rkward.cpp,1.104,1.105
- Next message: [rkward-cvs] rkward/rkward/windows rcontrolwindow.cpp,NONE,1.1 rcontrolwindow.h,NONE,1.1 Makefile.am,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/rkward/rkward/rkward/rbackend
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27157/rkward/rbackend
Modified Files:
rcommand.h rinterface.cpp rinterface.h rthread.cpp rthread.h
Log Message:
Adding new RControlWindow. Not completely/correctly implemented, yet
Index: rthread.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rthread.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** rthread.h 23 Sep 2005 17:19:30 -0000 1.15
--- rthread.h 13 Oct 2005 21:01:57 -0000 1.16
***************
*** 74,83 ****
~RThread();
/** Locks the thread. This is called by RInterface, when the currently running command is to be cancelled. It is used to make sure that the
! backend thread does not proceed with further commands, before the main thread takes notice. @see unlock @see RInterface::cancelCommand */
! void lock () { locked=true; };
! /** Unlocks the thread. The thread is initially locked so the main thread can check for some conditions before the backend thread may produce
! more errors/crashes. Also the thread may get locked when cancelling the currently running command. @see lock */
! void unlock () { locked=false; };
/** "Kills" the thread. Actually this just tells the thread that is is about to be terminated. Allows the thread to terminate gracefully */
void kill () { killed = true; };
--- 74,90 ----
~RThread();
+ /** @see lock (), @see unlock ()*/
+ enum LockType {
+ User=1, /**< locked on user request */
+ Cancel=2, /**< locked to safely cancel a running command */
+ Startup=4 /**< locked on startup */
+ };
/** Locks the thread. This is called by RInterface, when the currently running command is to be cancelled. It is used to make sure that the
! backend thread does not proceed with further commands, before the main thread takes notice. Also it is called, if the RThread is paused on User request. Further, the thread is initially locked so the main thread can check for some conditions before the backend thread may produce
! more errors/crashes. @see unlock @see RInterface::cancelCommand @see RInterface::pauseProcessing
! @param reason As there are several reasons to lock the thread, and more than one reason may be in place at a given time, a reason needs to be specified for both lock () and unlock (). Only if all "reasons are unlocked ()", processing continues. */
! void lock (LockType reason) { locked |= reason; };
! /** Unlocks the thread. Also the thread may get locked when cancelling the currently running command. @see lock */
! void unlock (LockType reason) { locked -= (locked & reason); };
/** "Kills" the thread. Actually this just tells the thread that is is about to be terminated. Allows the thread to terminate gracefully */
void kill () { killed = true; };
***************
*** 134,138 ****
void doCommand (RCommand *command);
! bool locked;
bool killed;
};
--- 141,145 ----
void doCommand (RCommand *command);
! int locked;
bool killed;
};
Index: rinterface.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rinterface.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** rinterface.h 29 Sep 2005 16:02:51 -0000 1.18
--- rinterface.h 13 Oct 2005 21:01:57 -0000 1.19
***************
*** 66,69 ****
--- 66,72 ----
void cancelCommand (RCommand *command);
+ /** Pauses process. The current command will continue to run, but no new command will be */
+ void pauseProcessing (bool pause);
+
static QMutex mutex;
static int mutex_counter;
Index: rthread.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rthread.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** rthread.cpp 12 Oct 2005 17:02:33 -0000 1.21
--- rthread.cpp 13 Oct 2005 21:01:57 -0000 1.22
***************
*** 48,52 ****
void RThread::run () {
RK_TRACE (RBACKEND);
! locked = true;
killed = false;
int err;
--- 48,52 ----
void RThread::run () {
RK_TRACE (RBACKEND);
! locked = Startup;
killed = false;
int err;
Index: rinterface.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rinterface.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** rinterface.cpp 2 Oct 2005 17:19:02 -0000 1.32
--- rinterface.cpp 13 Oct 2005 21:01:57 -0000 1.33
***************
*** 28,31 ****
--- 28,32 ----
#include "../dialogs/rkloadlibsdialog.h"
#include "../agents/showedittextfileagent.h"
+ #include "../windows/rcontrolwindow.h"
#include "rkwindowcatcher.h"
***************
*** 136,140 ****
running_command_canceled = 0;
R_interrupts_pending = 0;
! r_thread->unlock ();
}
}
--- 137,141 ----
running_command_canceled = 0;
R_interrupts_pending = 0;
! r_thread->unlock (RThread::Cancel);
}
}
***************
*** 151,155 ****
processRCallbackRequest (static_cast<RCallbackArgs *> (e->data ()));
} else if ((e->type () == RSTARTED_EVENT)) {
! r_thread->unlock ();
} else if ((e->type () > RSTARTUP_ERROR_EVENT)) {
int err = e->type () - RSTARTUP_ERROR_EVENT;
--- 152,156 ----
processRCallbackRequest (static_cast<RCallbackArgs *> (e->data ()));
} else if ((e->type () == RSTARTED_EVENT)) {
! r_thread->unlock (RThread::Startup);
} else if ((e->type () > RSTARTUP_ERROR_EVENT)) {
int err = e->type () - RSTARTUP_ERROR_EVENT;
***************
*** 165,169 ****
}
KMessageBox::error (0, message, i18n ("Error starting R"));
! r_thread->unlock ();
}
}
--- 166,170 ----
}
KMessageBox::error (0, message, i18n ("Error starting R"));
! r_thread->unlock (RThread::Startup);
}
}
***************
*** 173,176 ****
--- 174,178 ----
MUTEX_LOCK;
RCommandStack::issueCommand (command, chain);
+ RKGlobals::controlWindow ()->refreshCommands ();
MUTEX_UNLOCK;
}
***************
*** 181,184 ****
--- 183,187 ----
MUTEX_LOCK;
ret = RCommandStack::startChain (parent);
+ RKGlobals::controlWindow ()->refreshCommands ();
MUTEX_UNLOCK;
return ret;
***************
*** 190,193 ****
--- 193,197 ----
MUTEX_LOCK;
ret = RCommandStack::closeChain (chain);
+ RKGlobals::controlWindow ()->refreshCommands ();
MUTEX_UNLOCK;
return ret;
***************
*** 202,206 ****
if (command == r_thread->current_command) {
RK_ASSERT (!running_command_canceled);
! r_thread->lock ();
running_command_canceled = command;
// this is the var in R-space that stores an interrupt
--- 206,210 ----
if (command == r_thread->current_command) {
RK_ASSERT (!running_command_canceled);
! r_thread->lock (RThread::Cancel);
running_command_canceled = command;
// this is the var in R-space that stores an interrupt
***************
*** 211,217 ****
--- 215,229 ----
}
+ RKGlobals::controlWindow ()->refreshCommands ();
MUTEX_UNLOCK;
}
+ void RInterface::pauseProcessing (bool pause) {
+ RK_TRACE (RBACKEND);
+
+ if (pause) r_thread->lock (RThread::User);
+ else r_thread->unlock (RThread::User);
+ }
+
void RInterface::processREvalRequest (REvalRequest *request) {
RK_TRACE (RBACKEND);
Index: rcommand.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rcommand.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** rcommand.h 29 Sep 2005 16:02:51 -0000 1.17
--- rcommand.h 13 Oct 2005 21:01:57 -0000 1.18
***************
*** 36,39 ****
--- 36,40 ----
class RCommandChain {
protected:
+ friend class RControlWindow;
friend class RCommandStack;
QPtrList<RChainOrCommand> commands;
***************
*** 46,49 ****
--- 47,51 ----
class RChainOrCommand {
private:
+ friend class RControlWindow;
friend class RCommandStack;
RCommand *command;
- Previous message: [rkward-cvs] rkward/rkward rkglobals.cpp,1.8,1.9 rkglobals.h,1.7,1.8 rkward.cpp,1.104,1.105
- Next message: [rkward-cvs] rkward/rkward/windows rcontrolwindow.cpp,NONE,1.1 rcontrolwindow.h,NONE,1.1 Makefile.am,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the rkward-tracker
mailing list