• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thread confusion

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

im fairly new to thread.


Currently making a client/server application.
i create a server thread from the main GUI and then pass the gui object to the server thread.
Server thread is waiting for incoming connections . on a new connection it starts the connection handling in a new thread as application is multithreaded
Gui object from server thread is passed onto each of these new threads which can then update the main gui.

i know this is a bad way of doing it.

Any help to guide me in the right direction and suggestion would be much appreciated.


Thanks.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dave cbank wrote:
Currently making a client/server application.
i create a server thread from the main GUI and then pass the gui object to the server thread.
Server thread is waiting for incoming connections . on a new connection it starts the connection handling in a new thread as application is multithreaded
Gui object from server thread is passed onto each of these new threads which can then update the main gui.



If by GUI, you mean Swing, remember that it is *not* thread safe. You have to make sure that all changes are done by the event dispatch thread.

Henry
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic