This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: change in static modules


With the latest sources, configured --with-java-source=5, threads can no
longer update module-level variables.  I don't know if it's a side-effect of the
change you just made, but it's a relatively recent change; my app works
with a build that's just a few weeks old.

Example:

#!/usr/bin/env kawa

(define (print fmt #!optional args)
  (display (format fmt args))
  (force-output))

(define my-global "hello")

(print "my-global is: ~A~%" my-global)

(let ((thread
       (object (<java.lang.Thread>)
	       ((run) :: <void>
		(print "in thread.run()~%")
		(set! my-global "goodbye")))))
  (invoke thread 'start)
  (invoke thread 'join))

(print "my-global is now: ~A~%" my-global)

running this script prints:

my-global is: hello
in thread.run()
my-global is now: hello

This is independent of whether I include a (module-static) declaration.

Is it a bug, or the intended behavior?  If the latter, what's the best way
to allow changing the variable on a separate thread?

Thanks,

-steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]