Re: NewGlobalRef

Discussion in 'Java' started by Joseph Millar, Aug 4, 2003.

  1. On 4 Aug 2003 01:06:54 -0700, (Cengiz) wrote:

    > can anybody give me an examle for using of NewGlobalRef.


    I expect you mean why you would want to use it, so that's what
    I'll address. All locally allocated references in native code
    are thread specific. Trying to access a local reference from
    a thread other than the one in which it was created is going
    to cause your code to crash or behave badly. But that's not
    true of global references, so if you need access from multiple
    threads, turn your local reference into a global reference.
    Global references are also longer lived and not automatically
    freed when the native method that created them returns to
    Java.

    Hope that helps.

    --Joe
    Joseph Millar, Aug 4, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. FBergemann
    Replies:
    3
    Views:
    7,651
    FBergemann
    Apr 6, 2005
Loading...

Share This Page