Re: Multithreading
From: Ioannis Vranos (ivr_at_remove.this.grad.com)
Date: 02/23/05
- Next message: Ioannis Vranos: "Re: MTA vs STA ApartmentStates"
- Previous message: Alper AKCAYOZ: "RE: Grid"
- In reply to: Alper AKCAYOZ: "Multithreading"
- Next in thread: Vladimir Nesterovsky: "Re: Multithreading"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 23 Feb 2005 13:33:45 +0200
Alper AKCAYOZ wrote:
> Hello,
> I am developing a TCP/IP Client application in Windows Forms (.NET)
> template. I use one MDI form as initial form where I connect to server and
> starts a background thread (thread_A) for receiving data. Here, I use the
> Socket_A
>
> By clicking a toolbarbutton, I send a command to server. If it is
> successfull, I opened the MDI-Child form with "frmChildForm->Show();" command.
> I create two more sockets (Socket_B, Socket_C) at child form and start
> receiving continuously (in while-loops) with two threads (Thread_B,
> Thread_C). I display the data coming from these sockets on 25 textboxes
> (Thread_B with Socket_B) and on 3 data-grids (Thread_C with Socket_C). These
> operations must be as fast as possible. Thread_B and Thread_C are not sharing
> any data, they are independent.
>
> I could not speed up the data-receving which means I could not order Threads.
> I read several documents at MSDN like ThreadPool, Monitor. But I could not
> solve my problem. I put several "Thread::Sleep(...);" in Thread_B and
> Thread_C, but it is not still working properly. Data on textboxes and
> datagrids are not changing fast, sometimes some values are stucking.
>
> I am requesting a way to make use of Threads more efficiently.?
>
> I thank you so much in advance.
I know .NET multithreading. In .NET, for thread synchronization you need
to use lock-based multithreading, by getting and release the thread
lock. This is done by using some .NET facilities which include
Monitor::Enter() to acquire the lock, Monitor::Exit() to release the
lock, however the lock is released implicitly in a Monitor::Wait() call.
A nice beginner to intermediate level book that you can read, and covers
all .NET facilities, and covers multithreading as also networking among
them, is "Visual C++ .NET How To Program" by Deitel.
http://vig.prenhall.com/catalog/academic/product/0,1144,0134373774,00.html
-- Ioannis Vranos
- Next message: Ioannis Vranos: "Re: MTA vs STA ApartmentStates"
- Previous message: Alper AKCAYOZ: "RE: Grid"
- In reply to: Alper AKCAYOZ: "Multithreading"
- Next in thread: Vladimir Nesterovsky: "Re: Multithreading"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|