summaryrefslogtreecommitdiff
path: root/libcult/cult/sched/mutex.hxx
blob: 0c6daee404990f01e6d68b3c69a734c603222ce3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// file      : cult/sched/mutex.hxx
// author    : Boris Kolpackov <boris@kolpackov.net>
// copyright : Copyright (c) 2005-2010 Boris Kolpackov
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#ifndef CULT_SCHED_MUTEX_HXX
#define CULT_SCHED_MUTEX_HXX

#include <cult/types/fundamental.hxx>

#include <pthread.h>

namespace Cult
{
  namespace Sched
  {
    class Mutex: public NonCopyable
    {
    public:
      ~Mutex ();

      Mutex ();

      Void
      lock ();

      Boolean
      try_lock ();

      Void
      unlock ();

    private:
      friend class Condition;

      pthread_mutex_t mutex_;
    };
  }
}

#endif  // CULT_SCHED_MUTEX_HXX