in reply to Runing "regular" code with threaded perl

Whatever your problem is, threading support has nothing to do with it. It simply allows you to use use threads to create threads. It has no affect on how system works. If you don't create threads, the only difference with using a threaded build is a performance penalty.

for instance, a system() call creates a file, but the code tries to access the file before the system call is done making it

system won't return until the child exists and therefore after the child is done writing. Processes that don't exist can't write to files, so what you say makes no sense unless the child spawned a detached child and this detached process is actually doing the writing.

Replies are listed 'Best First'.
Re^2: Runing "regular" code with threaded perl
by moritz (Cardinal) on Jul 10, 2008 at 07:40 UTC
    Whatever your problem is, threading support has nothing to do with it.

    I agree. And I think that the bugs was present before, and only revealed by switching to a system with real concurrency (better operating system, multi core processor or both).

      I do not "use threads" in my code. Whether it makes sense or not (it certainly doesn't to me), the fact is that this works:

      system("xspec - ${tmp}.xcm");

      open(DAT, "${tmp}xsfit.dat") || die ("Could not open file!");

      whereas this does not:

      bjmsys("xspec - ${tmp}.xcm", $v);

      open(DAT, "${tmp}xsfit.dat") || die ("Could not open file!");

      where------------

      sub bjmsys {

      my $arg=shift;

      my $v=shift;

      $v=0 unless defined $v;

      my $status;

      print "$arg\n" if $v>1||$v<0;

      $status=system("$arg");

      print "return status = $status\n" if $v>1;

      return $status;

      }
        Curious. What do you mean with "it doesn't work"? Does it die with "Could not open file"?
        []s, HTH, Massa