Yeah, it probably would have helped if I included that, wouldn't it? :)

Here it is:

    #!/usr/bin/csi -script

    (use extras)
    (use srfi-18)
    (use tcp)

    (define num-threads 2)

    (define (connect port)
      (let-values (((i o) (tcp-connect "192.168.1.101" port)))
        (read i)))

    (let loop ((port 9000) (threads '()))
      (if (= (length threads) num-threads)
        (for-each thread-join! threads)
        (loop (+ port 1) (cons (thread-start! (lambda () (connect port)))
                               threads))))


On Sun, Jul 6, 2014 at 7:35 PM, Alan Post <alanp...@sunflowerriver.org>
wrote:

> Did I miss the source to threadtest.scm here?  The file that
> contains the variable num-threads?  I don't see it.
>
> -a
>
> On Sun, Jul 06, 2014 at 05:41:44PM -0700, Christopher Collins wrote:
> >    Version info:
> >    ****** CHICKEN
> >    ****** (c) 2008-2013, The Chicken Team
> >    ****** (c) 2000-2007, Felix L. Winkelmann
> >    ****** Version 4.8.0.3 (stability/4.8.0) (rev 091c3d9)
> >    ****** linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
> >    ****** compiled 2013-03-12 on aeryn.xorinia.dim (Darwin)
> >
> >    Hi,
> >    ******
> >    I'm encountering a crash with some multithreaded tcp code.** I am at a
> >    loss as to what I'm doing wrong; I was hoping someone else could spot
> my
> >    mistake.
> >
> >    Below is a simple program which produces the crash.** When I run it,
> I get
> >    the following output:
> >
> >    ****** *** Error in `/usr/bin/csi': realloc(): invalid next size:
> >    0x0000000001c05210 ***
> >
> >    I run the program as follows:
> >    1. Start two instances of nc; one listening on [1]192.168.1.101:9000,
> the
> >    other on [2]192.168.1.101:9001.** Redirect a ~1KB file to nc, such
> that nc
> >    will send the file to whomever connects to it.
> >    2. Run the scheme script
> >
> >    e.g.:
> >    ****** nc -l 192.168.1.101 -p 9000 < ~/tmpfile
> >    ****** nc -l 192.168.1.101 -p 9001 < ~/tmpfile
> >    ****** ./threadtest.scm
> >    ******
> >    If I change the definition of num-threads from 2 to 1, the program
> runs to
> >    completion.
> >
> >    Any ideas?
> >
> >    Thanks,
> >    Christopher
> >
> > References
> >
> >    Visible links
> >    1. http://192.168.1.101:9000/
> >    2. http://192.168.1.101:9001/
>
> > _______________________________________________
> > Chicken-users mailing list
> > Chicken-users@nongnu.org
> > https://lists.nongnu.org/mailman/listinfo/chicken-users
>
>
> --
> my personal website: http://c0redump.org/
>
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to