473,320 Members | 1,988 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Hi guys..problem with using notify() & wait()

1
i am learning java. in multithreading i want to put a thread to wait() and then call back it by notify() .. but i am not able to do so. can any one explain it to me by simple example..
Jul 4 '07 #1
3 1603
r035198x
13,262 8TB
i am learning java. in multithreading i want to put a thread to wait() and then call back it by notify() .. but i am not able to do so. can any one explain it to me by simple example..
Cookies my friend, cookies.
Jul 4 '07 #2
praveen2gupta
201 100+
i am learning java. in multithreading i want to put a thread to wait() and then call back it by notify() .. but i am not able to do so. can any one explain it to me by simple example..
Hi
I gives you a brief idea for writing Multi Threading Program.

1. Declare a class as extending the thread class.

Ex. class classname extends Thread
{

}
java.lang.thread is a superclass for the multiple thraeding.

2. overriding the the run method

Ex public void run()
{
}

3. create the object of main class and call start method to.

Ex. new P().start();
Jul 4 '07 #3
JosAH
11,448 Expert 8TB
Hi
I gives you a brief idea for writing Multi Threading Program.

1. Declare a class as extending the thread class.
That is considered bad practice: better implement the Runnable interface and
feed that to a Thread object itself. If you extend from the Thread class you can't
extend from another class anymore and closely ties your implementation to
the Thread class just for utility purposes; don't do that.

kind regards,

Jos
Jul 4 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Pudibund | last post by:
Ok, I've spent nearly a week trying to sort what should be an easy task to accomplish but I'm totally flumoxed! I want to do something pretty simple... 1. display image1 2. wait until...
0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
4
by: Alban Hertroys | last post by:
Hello all, I need your wisdom again. I'm working on a multi-threaded application that handles multiple data sources in small batches each time. The idea is that there are 3 threads that run...
38
by: jrlen balane | last post by:
basically what the code does is transmit data to a hardware and then receive data that the hardware will transmit. import serial import string import time from struct import * ser =...
1
by: Alessandro GARDICH | last post by:
Hi to all I have problem with NOTIFY/LISTEN ... I'm writing a C++ application with libpqxx, I thought was a problem of the lib but I try also with a C program using libpq with the same result,...
4
by: Joe Lester | last post by:
I'm using PostgreSQL 7.4.1. I have 140 clients connected on average using libpq. When one client sends "NOTIFY timeclock;" to the server all 140 clients are listening for it. After receiving a...
5
by: cozsmin | last post by:
hello , as u know wait() and notify() will not thow an exception if the method that calls them has the lock , or esle i misundrestood java :P this is the code that throws (unwanted) ...
19
by: =?ISO-8859-1?Q?Nordl=F6w?= | last post by:
I am currently designing a synchronized queue used to communicate between threads. Is the code given below a good solution? Am I using mutex lock/unlock more than needed? Are there any resources...
2
by: greyradio | last post by:
I've recently have been given an assignment to do and it seems that notify() does notify() any of the waiting threads. The project entails 10 commuters and two different toll booths. The EZPass booth...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.