Thread: pthread_mutex_t

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    1

    pthread_mutex_t

    Hi

    Could someone tell to explain what is thing does in linux?
    or where i can get some info on this?

    Thanks

  2. #2

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Well...looking up the documentation for such a well documented OS would be a good place to start typically. But since that requires too much effort for you it requires too much for me as well. So instead I'll just guess. I believe it is a handle to thread_mutex object. I assume that it is used for multithreading an application and/or used for running a multithreaded environment. It would run like a mutex (it waits for a turn to process). In the future try looking it up on google.

  4. #4
    Registered User
    Join Date
    Feb 2004
    Posts
    79
    Master5001, FYI pthreads are the premier thread
    library used in C programming and on most platforms.

    Anyway clive,

    pthread_mutex_t is used to declare an object of type mutex.

    thus: pthread_mutex_t mymutexvariable;

    You would then use the mutex variable to lock and unlock a mutex.

    eg:
    pthread_mutex_lock(&mymutexvariable);
    /* critical section */
    pthread_mutex_unlock(&mymutexvariable);

    see here for more info...

    clive, if you have any further questions regarding pthreads there
    is a thread already started regarding posix threads.

    Hope that helps.
    R.I.P C89

Popular pages Recent additions subscribe to a feed