Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29338

thread: catch the current thread in a share object

Newsgroups comp.lang.java.programmer
Date 2014-07-26 09:20 -0700
Message-ID <61f2c6cc-5832-466c-ac70-325df061fb17@googlegroups.com> (permalink)
Subject thread: catch the current thread in a share object
From Bert_emme <bertanimauro@gmail.com>

Show all headers | View raw


I try to implement a share object between thread. In the share object there is a queue. I want that if a condition is realizated the thread that at the moment lock the object go in wait and I want to put it in the queue of the shared object. But I don't idea on how referencing to this thread.
Example

class ObjShare{
    Queue q;

    public synchronized mymethod(){
     
        if(condition){
           q.put(thecurrentthread)
           wait();
        }
    }

}

Thanks in advance
Mauro

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

thread: catch the current thread in a share object Bert_emme <bertanimauro@gmail.com> - 2014-07-26 09:20 -0700
  Re: thread: catch the current thread in a share object markspace <markspace@nospam.nospam> - 2014-07-26 10:08 -0700
  Re: thread: catch the current thread in a share object Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-26 14:19 -0400
    Re: thread: catch the current thread in a share object Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-27 08:06 -0400
  Re: thread: catch the current thread in a share object Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-07-26 14:04 -0700

csiph-web