Thanks for your reply. I was about to ask that I am not able to use C++
backend, although Java backend run fine. Since I am programming for getting
performance, I do want to get C++. Here is the error on running
HelloWorld.x10:

$ ~/Downloads/bin/x10c++ -o HelloWorld HelloWorld.x10
*x10c++: ~/Downloads/stdlib/lib/libx10.so: undefined reference to
`std::basic_ostream<char, std::char_traits<char> >&
std::__ostream_insert<char, std::char_traits<char>
>(std::basic_ostream<char, std::char_traits<char> >&, char const*,
long)@GLIBCXX_3.4.9'
     collect2: ld returned 1 exit status
x10c++: Non-zero return code: 1
2 errors.*

Same program runs fine with java backend. Program is:

*public class HelloWorld {
public static def main(args: Array[String](1)) {
x10.io.Console.OUT.println("Hello, World");
}*


I have also been trying to see internet, but to no avail.

Thanks and Regards
Sparsh Mittal



On Mon, Feb 11, 2013 at 1:49 PM, David P Grove <gro...@us.ibm.com> wrote:

>  Sparsh Mittal <sparsh0mit...@gmail.com> wrote on 02/11/2013 01:00:02 PM:
>
> >
> > Hello
> > I am using the following program, with the aim of running external
> > binary (in place of "sleep 500"). The problem is that after issuing
> > Runtime.execForWrite, the control does not wait till the end of this
> > command, which is not what I want. Can you suggest a way, so that I
> > can make control wait till the  Runtime.execForWrite("Command")
> > waits till end of   Command. Thanks.
> >
> > ===============================================
> > import x10.io.Console;
> > import x10.lang.Runtime;
> >
> > public class CheckForBlockingCommand {
> >
> >   public static def main(Array[String]) {
> >     val TIMES: int = 10;
> >     for(var k: Int =0; k< TIMES; k++) {
> >     Console.OUT.println(" I am launching "+ k);
> >     Runtime.execForWrite("sleep 500");
> >     }
> >       Console.OUT.println("Done!" );
> >   }
> > }
> >
> >
>
> Hi,
>
>  Runtime.execForWrite/Read fork a new process, but do not wait for the
> forked process to complete before returning.  With the C++ backend of X10,
> you can call close on the returned Writer to wait as shown below.  With the
> Java backend of X10, this doesn't work (won't wait) due to API differences
> between C and Java stdlibs  (it could be made to work in X10 by calling
> waitFor on the java.lang.Process object returned from
> java.lang.Runtime.exec, but that is not exposed at the X10 level.  You'd
> have to tweak the Java code implementing the native method if you need this
> on the Java backend of X10.
>
>
> public class CheckForBlockingCommand {
>
> public static def main(Array[String]) {
> val TIMES: int = 10;
> for(var k: Int =0; k< TIMES; k++) {
> Console.OUT.println(" I am launching "+ k);
> val t = Runtime.execForWrite("sleep 5");
> t.close();
> }
> Console.OUT.println("Done!" );
> }
> }
>
> --dave
>
>
>
> ------------------------------------------------------------------------------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013
> and get the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> X10-users mailing list
> X10-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/x10-users
>
>
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to