Help on Multithreading in C
Hello friends.......I am new to this sort of programming aka Multithreading and I am involved in a project where I need to use multithreading to make my system perform several tasks parallely. So I need to know can we do multithreading in C. If yes then can somebody suggest me some tutorial that may help me. I shall be very thankful.
Re: Help on Multithreading in C
If you want using multithreading in Windows then have a look at:
_beginthread, _beginthreadex
_endthread, _endthreadex
Re: Help on Multithreading in C
What kind of task are you trying to parallelize?
Re: Help on Multithreading in C
I am working on a project related to audio capturing and sending the data over the network to the server for processing. So the task is make the process multithreaded such that the system keeps on capturing the data and sending the captures data to the server. Can u help me in this regard ?
Re: Help on Multithreading in C
Well you have a lot of things going on.
you need a multi-threaded sockets to accomplish this.
You may need to use UDP to achieve the speeds you desire, although you would have to do some testing of your application. TCP has certain built in limits.
http://tangentsoft.net/wskfaq/exampl...ed-server.html
The TangentSoft site is good for examples on Windows. Are you using Linux or some other OS?
Re: Help on Multithreading in C
FYI: You are going to have huge latency problems. About 70ms to get it through the PC and then however long it takes to send it down the pipe to the client PC.
If you use the Windows MM API you cannot get better than about 180ms on a PC, if you use something like ASIO, you can get down to about 100ms (but remember ASIO only supports one soundcard), if you use DirectX you can get down to about 70ms.
There is a kernel mode sound API, but MS doesn't publish it and no one here has ever been able to get the API (I have been trying for about 10 years).
I did a small communications app and the latency varied between 140ms and 570ms over my local 1000base-T network with standard TCP sockets.
Skype and it's bretheren can get away with this because humans can communicate slower than PCs can.
-Erik
Re: Help on Multithreading in C
Quote:
Originally Posted by
egawtry
Skype and it's bretheren can get away with this because humans can communicate slower than PCs can.
-Erik
Not to mention the fact that the sample rate for these is probably a lot lower then that of a CD. IIRC, POTS frequency range was something like 2000-6000Hz. Which is pretty much all Skype really needs to support.
Viggy
Re: Help on Multithreading in C
Quote:
Originally Posted by
saviour2009
Hello friends.......I am new to this sort of programming aka Multithreading and I am involved in a project where I need to use multithreading to make my system perform several tasks parallely. So I need to know can we do multithreading in C. If yes then can somebody suggest me some tutorial that may help me. I shall be very thankful.
You can make use of POSIX Thread Programming which can work on both on Linux and Windows.