Thread issues
From: Dean (dean[no-spam)
Date: 01/14/04
- Next message: Rudy Velthuis (TeamB): "Re: Using .NET framework objects from within VCL.NET project in delphi 8"
- Previous message: Mike Shkolnik: "Re: RichEdit1.Lines.SaveToFile saves junk characters"
- Next in thread: valentin tihomirov: "Re: Thread issues"
- Reply: valentin tihomirov: "Re: Thread issues"
- Reply: Martin James: "Re: Thread issues"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 14 Jan 2004 12:11:37 -0000
Sorry if this question comes over as a bit newbie, but I am basically new to
the concept of threads, although not to Delphi (or C++) or programming in
general.
I have a VOIP audio server application whcih I developed using a customised
TIdTCPServer object. The server is designed to cope with something 150 or so
connected clients, with audio being streamed at a fairly low bit rate.
Different connected clients can connect to different "channels" on the
server, so A & B can be talking on channel 1 for example, and C & D can be
talking on channel 2 at the same time.
Taking that example further, we have 4 threads (A B C and D) representing
four client connections. A is talking to B at a particular moment in time.
In order to do the audio processing, the server has to do the following:-
1. Lock the threadlist
2. Get in audio packets from A and send to B's thread.
3. Unlock the threadlist.
Problem is, locking the threadlist effectively locks C & D's threads
unnecessarily.
Code like this is potentially slow and cumbersome. I'm looking for an
alternative design to this kind of structure, but still using threads.
Is there any way, for example, that I can lock just A & B's threads, if I
maintain my own TList of pointers for, say, channel 1?
I'm also trying to work out in my own mind whether or not locking is
required at all. None of the threads are accessing global pointers,
everything is within their own thread. They are calling methods on other
threads (writedatatosocket type stuff) but that's all.
I'm wondering if I could call a lock on ThreadList, just to get the list of
pointers I need, then unlock it immediately before I actually start
processing?
Any good books around on threading?
D
- Next message: Rudy Velthuis (TeamB): "Re: Using .NET framework objects from within VCL.NET project in delphi 8"
- Previous message: Mike Shkolnik: "Re: RichEdit1.Lines.SaveToFile saves junk characters"
- Next in thread: valentin tihomirov: "Re: Thread issues"
- Reply: valentin tihomirov: "Re: Thread issues"
- Reply: Martin James: "Re: Thread issues"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|