CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2010
    Posts
    5

    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.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Help on Multithreading in C

    If you want using multithreading in Windows then have a look at:
    _beginthread, _beginthreadex
    _endthread, _endthreadex
    Victor Nijegorodov

  3. #3
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Help on Multithreading in C

    What kind of task are you trying to parallelize?

  4. #4
    Join Date
    Mar 2010
    Posts
    5

    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 ?

  5. #5
    Join Date
    Mar 2001
    Posts
    2,529

    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?
    ahoodin
    To keep the plot moving, that's why.

  6. #6
    Join Date
    Oct 2005
    Location
    Minnesota, U.S.A.
    Posts
    680

    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

  7. #7
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Help on Multithreading in C

    Quote Originally Posted by egawtry View Post
    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

  8. #8
    Join Date
    Sep 2005
    Location
    New Delhi, India
    Posts
    332

    Re: Help on Multithreading in C

    Quote Originally Posted by saviour2009 View Post
    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.
    Appreciate others by rating good posts

    "Only buy something that you'd be perfectly happy to hold if the market shut down for 10 years." - Warren Buffett

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured