Yurttas/PL/OOL/Cplusplus/F/02/08/01/00/mutex.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 2005
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9 
10   date   : September 1, 2005.
11   author : Austin W. Westfall, Salih Yurttas.
12
13   mutex.cpp
14*/
15
16
17#include "mutex.h"
18
19mutex::
20mutex() {
21  pthread_mutex_init(&mut, 0);
22}
23
24mutex::
25~mutex() {
26  pthread_mutex_destroy(&mut);
27}
28
29void
30mutex::
31lock() {
32  pthread_mutex_lock(&mut);
33}
34
35void
36mutex::
37unlock() {
38  pthread_mutex_unlock(&mut);
39}