root / Community Core Vision / Windows / libs / poco / include / Poco / NamedMutex_WIN32U.h @ 8

View | Annotate | Download (2.1 KB)

1 8 amit
//
2 8 amit
// NamedMutex_WIN32U.h
3 8 amit
//
4 8 amit
// $Id: //poco/1.3/Foundation/include/Poco/NamedMutex_WIN32U.h#2 $
5 8 amit
//
6 8 amit
// Library: Foundation
7 8 amit
// Package: Processes
8 8 amit
// Module:  NamedMutex
9 8 amit
//
10 8 amit
// Definition of the NamedMutexImpl class for Windows.
11 8 amit
//
12 8 amit
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
13 8 amit
// and Contributors.
14 8 amit
//
15 8 amit
// Permission is hereby granted, free of charge, to any person or organization
16 8 amit
// obtaining a copy of the software and accompanying documentation covered by
17 8 amit
// this license (the "Software") to use, reproduce, display, distribute,
18 8 amit
// execute, and transmit the Software, and to prepare derivative works of the
19 8 amit
// Software, and to permit third-parties to whom the Software is furnished to
20 8 amit
// do so, all subject to the following:
21 8 amit
//
22 8 amit
// The copyright notices in the Software and this entire statement, including
23 8 amit
// the above license grant, this restriction and the following disclaimer,
24 8 amit
// must be included in all copies of the Software, in whole or in part, and
25 8 amit
// all derivative works of the Software, unless such copies or derivative
26 8 amit
// works are solely in the form of machine-executable object code generated by
27 8 amit
// a source language processor.
28 8 amit
//
29 8 amit
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 8 amit
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 8 amit
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
32 8 amit
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
33 8 amit
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
34 8 amit
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35 8 amit
// DEALINGS IN THE SOFTWARE.
36 8 amit
//
37 8 amit
38 8 amit
39 8 amit
#ifndef Foundation_NamedMutex_WIN32U_INCLUDED
40 8 amit
#define Foundation_NamedMutex_WIN32U_INCLUDED
41 8 amit
42 8 amit
43 8 amit
#include "Poco/Foundation.h"
44 8 amit
#include "Poco/UnWindows.h"
45 8 amit
46 8 amit
47 8 amit
namespace Poco {
48 8 amit
49 8 amit
50 8 amit
class Foundation_API NamedMutexImpl
51 8 amit
{
52 8 amit
protected:
53 8 amit
        NamedMutexImpl(const std::string& name);
54 8 amit
        ~NamedMutexImpl();
55 8 amit
        void lockImpl();
56 8 amit
        bool tryLockImpl();
57 8 amit
        void unlockImpl();
58 8 amit
59 8 amit
private:
60 8 amit
        std::string  _name;
61 8 amit
        std::wstring _uname;
62 8 amit
        HANDLE       _mutex;
63 8 amit
};
64 8 amit
65 8 amit
66 8 amit
} // namespace Poco
67 8 amit
68 8 amit
69 8 amit
#endif // Foundation_NamedMutex_WIN32U_INCLUDED