semaphore_windows.hpp revision 8656:289a2d2a8f97
133965Sjdp/*
278828Sobrien * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3130561Sobrien * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
433965Sjdp *
533965Sjdp * This code is free software; you can redistribute it and/or modify it
633965Sjdp * under the terms of the GNU General Public License version 2 only, as
733965Sjdp * published by the Free Software Foundation.
833965Sjdp *
933965Sjdp * This code is distributed in the hope that it will be useful, but WITHOUT
1033965Sjdp * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1133965Sjdp * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1233965Sjdp * version 2 for more details (a copy is included in the LICENSE file that
1333965Sjdp * accompanied this code).
1433965Sjdp *
1533965Sjdp * You should have received a copy of the GNU General Public License version
1633965Sjdp * 2 along with this work; if not, write to the Free Software Foundation,
1733965Sjdp * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1833965Sjdp *
1933965Sjdp * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2033965Sjdp * or visit www.oracle.com if you need additional information or have any
2133965Sjdp * questions.
2233965Sjdp *
23130561Sobrien */
2433965Sjdp
2533965Sjdp#ifndef OS_WINDOWS_VM_SEMAPHORE_WINDOWS_HPP
2633965Sjdp#define OS_WINDOWS_VM_SEMAPHORE_WINDOWS_HPP
2733965Sjdp
2833965Sjdp#include "memory/allocation.hpp"
2933965Sjdp
30130561Sobrien#include <windef.h>
3133965Sjdp
3233965Sjdpclass WindowsSemaphore : public CHeapObj<mtInternal> {
3333965Sjdp  HANDLE _semaphore;
3433965Sjdp
3533965Sjdp  // Prevent copying and assignment.
3633965Sjdp  WindowsSemaphore(const WindowsSemaphore&);
3733965Sjdp  WindowsSemaphore& operator=(const WindowsSemaphore&);
3860484Sobrien
3933965Sjdp public:
4033965Sjdp  WindowsSemaphore(uint value = 0);
4133965Sjdp  ~WindowsSemaphore();
4233965Sjdp
4333965Sjdp  void signal(uint count = 1);
4433965Sjdp
4533965Sjdp  void wait();
4633965Sjdp};
47104834Sobrien
48104834Sobrientypedef WindowsSemaphore SemaphoreImpl;
49104834Sobrien
5033965Sjdp#endif // OS_WINDOWS_VM_SEMAPHORE_WINDOWS_HPP
5160484Sobrien