]> git.lyx.org Git - features.git/commitdiff
lyx-devel.diff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 1 Mar 2001 14:26:01 +0000 (14:26 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 1 Mar 2001 14:26:01 +0000 (14:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1650 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/ChangeLog
src/support/filetools.C
src/support/syscall.C
src/support/syscall.h

index fee26038b30ce6293e3a6708308cd8b5ccf6beef..8edc1e5142b6aaa6ccfd079a373df599c244fbc4 100644 (file)
@@ -1,3 +1,10 @@
+2001-02-28  Baruch Even  <baruch@ev-en.org>
+
+       * filetools.C: Removed dependency on syscall.h
+
+       * syscall.h:
+       * syscall.C: Minor cleanings before I start to touch this code.
+
 2001-02-27  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
        * filetools.C (CreateTmpDir): change umask to 0700.
index 725e1557a1b6b31055f5ac452223207e474a231a..b9de57da7b8d278da317a2ffd208ca7bba6fefe3 100644 (file)
@@ -32,7 +32,6 @@
 #include "lyx_gui_misc.h"
 #include "FileInfo.h"
 #include "support/path.h"        // I know it's OS/2 specific (SMiyata)
-#include "support/syscall.h"
 #include "gettext.h"
 #include "lyxlib.h"
 
index 5df0404cd119f8cfa242c674c35c499dff9617cc..46591cc82a7a5dcc52d6a0696e4f571c232b1a92 100644 (file)
@@ -25,12 +25,7 @@ Systemcalls::Systemcalls() {
 
 Systemcalls::Systemcalls(Starttype how, string const & what, Callbackfct cback)
 {
-       start   = how;
-       command = what;
-       cbk     = cback;
-       pid     = static_cast<pid_t>(0);
-       retval  = 0;
-       startscript();
+       startscript(how, what, cback);
 }
 
 Systemcalls::~Systemcalls() {
@@ -95,7 +90,7 @@ void Systemcalls::kill(int /*tolerance*/) {
        if (wait_for_death) {
                // Here, we should add the PID to a list of
                // waiting processes to kill if they are not
-               // dead without tolerance seconds
+               // dead within tolerance seconds
 
                // CHECK Implement this using the timer of
                // the singleton systemcontroller (Asger)
@@ -144,14 +139,16 @@ pid_t Systemcalls::fork()
 {
        pid_t cpid= ::fork();
        if (cpid == 0) { // child
+               // TODO: Consider doing all of this before the fork, otherwise me
+               // might have troubles with multi-threaded access. (Baruch 20010228)
                string childcommand(command); // copy
                string rest = split(command, childcommand, ' ');
                const int MAX_ARGV = 255;
                char *syscmd = 0; 
                char *argv[MAX_ARGV];
                int  index = 0;
-               bool more;
-               do {
+               bool more = true;
+               while (more) {
                        childcommand = frontStrip(childcommand);
                        if (syscmd == 0) {
                                syscmd = new char[childcommand.length() + 1];
@@ -169,7 +166,7 @@ pid_t Systemcalls::fork()
                        more = !rest.empty();
                        if (more) 
                                rest = split(rest, childcommand, ' ');
-               } while (more);
+               }
                argv[index] = 0;
                // replace by command. Expand using PATH-environment-var.
                execvp(syscmd, argv);
@@ -187,7 +184,7 @@ pid_t Systemcalls::fork()
 // Reuse of instance
 
 int Systemcalls::startscript(Starttype how, string const & what, 
-                            Callbackfct cback)
+                             Callbackfct cback)
 {
        start   = how;
        command = what;
index 4aa51cece7da1f84fdfb4d93aa5f767e63e7450a..dd014ae112ca22e78711016c569db9767161d104 100644 (file)
@@ -86,6 +86,7 @@ public:
            When the child is dead, the callback is called.
        */
        void kill(int tolerance = 5);
+
 private:
        /// Type of execution: system, wait for child or background
        Starttype start;