[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another threading question



On Sun, Jan 14, 2001 at 06:27:33AM -0800, Matthew Flatt wrote:
> More specifically, I'm guessing that you have
> 
>  (thread (exn-catching-apply (lambda () ... do work ...)))
> 
> and you need to thunk the application:
> 
>  (thread (lambda () (exn-catching-apply (lambda () ... do work ...))))
> 
> Probably you'll need to use scheme_make_closed_prim to implement the
> outer thunk.
> 

I went back to my working "non-threaded" version of the code,
and tried to run an "application" that looks like this:

(thread
  (lambda ()
    (begin
      (display "Content-type: text/html")
      (newline)
      (newline)
      (display "<HTML><HEAD>")
      (display "<TITLE>Test</TITLE>")
      (display "<BODY><H1>Another Test</H1>")
      (display "Another Exceptional Test!")
      (display "<B>")
      (display "Did I work?")
      (display "</HTML>"))
))

But again I got the same group of errors:

[Switching to Thread 4101 (LWP 2729)]
0x402329ae in is_stack_too_shallow2 () at ./process.c:1610
1610      scheme_check_stack_ok(s);
(gdb) bt
#0  0x402329ae in is_stack_too_shallow2 () at ./process.c:1610
#1  0x402329d5 in is_stack_too_shallow () at ./process.c:1620
#2  0x40232a47 in scheme_thread_w_manager (thunk=0x40316538, 
    config=0x402d4270, mgr=0x0) at ./process.c:1669
#3  0x4023283e in scheme_thread (thunk=0x40316538, config=0x402d4270)
    at ./process.c:1525
#4  0x40232872 in sch_thread (argc=1, args=0x402ebe38) at ./process.c:1535
#5  0x4020c260 in scheme_do_eval (obj=0x4032f788, num_rands=1, 
    rands=0x402ebe38, get_value=1) at ./eval.c:2592
#6  0x4020c88c in eval_k () at ./eval.c:2997
#7  0x402112b5 in scheme_top_level_do (k=0x4020c7ec <eval_k>, eb=1)
    at ./fun.c:883
#8  0x4020c8e3 in _eval (obj=0x40316540, isexpr=0, multi=0, top=1)
    at ./eval.c:3014
#9  0x4020c8fc in scheme_eval_compiled (obj=0x40316540) at ./eval.c:3021
#10 0x40203a22 in handle_request (request=0x81a6a30) at mv_interps.cc:333
#11 0x40203cd2 in Run (arg=0x8161e40) at mv_interps.cc:402
#12 0x811910b in NsThreadMain ()
#13 0x4002dc95 in pthread_start_thread () from /lib/libpthread.so.0
#14 0x4002dcdd in pthread_start_thread_event () from /lib/libpthread.so.0

Does this code look right?  Actually, I guess the code actually looks
like this:

(begin
 (thread
  (lambda ()
    (begin
      (display "Content-type: text/html")
      (newline)
      (newline)
      (display "<HTML><HEAD>")
      (display "<TITLE>Test</TITLE>")
      (display "<BODY><H1>Another Test</H1>")
      (display "Another Exceptional Test!")
      (display "<B>")
      (display "Did I work?")
      (display "</HTML>"))
)))

Which is then compiled to a thunk prior to being run as:

scheme_eval_compiled(thunk, env);

(Where 'env' right now is just the regular scheme_config
environment).

Shouldn't this test at least work?  I'm wondering if my
SGC-built MzScheme has some kind of threading bug in it...

Any ideas?

Thanks,

-Brent