DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2005-2008. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/interprocess for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_INTERPROCESS_SEMAPHORE_HPP #define BOOST_INTERPROCESS_SEMAPHORE_HPP #if (defined _MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #include
#include
#include
#include
#include
#if defined BOOST_INTERPROCESS_POSIX_PROCESS_SHARED &&\ defined BOOST_INTERPROCESS_POSIX_SEMAPHORES #include
//O_CREAT, O_*... #include
//close #include
//std::string #include
//sem_* family, SEM_VALUE_MAX #include
//mode_t, S_IRWXG, S_IRWXO, S_IRWXU, #include
#define BOOST_INTERPROCESS_USE_POSIX #else #include
#include
#include
#include
#include
#define BOOST_INTERPROCESS_USE_GENERIC_EMULATION #endif //!\file //!Describes a interprocess_semaphore class for inter-process synchronization namespace boost { namespace interprocess { //!Wraps a interprocess_semaphore that can be placed in shared memory and can be //!shared between processes. Allows timed lock tries class interprocess_semaphore { /// @cond //Non-copyable interprocess_semaphore(const interprocess_semaphore &); interprocess_semaphore &operator=(const interprocess_semaphore &); /// @endcond public: //!Creates a interprocess_semaphore with the given initial count. //!interprocess_exception if there is an error.*/ interprocess_semaphore(int initialCount); //!Destroys the interprocess_semaphore. //!Does not throw ~interprocess_semaphore(); //!Increments the interprocess_semaphore count. If there are processes/threads blocked waiting //!for the interprocess_semaphore, then one of these processes will return successfully from //!its wait function. If there is an error an interprocess_exception exception is thrown. void post(); //!Decrements the interprocess_semaphore. If the interprocess_semaphore value is not greater than zero, //!then the calling process/thread blocks until it can decrement the counter. //!If there is an error an interprocess_exception exception is thrown. void wait(); //!Decrements the interprocess_semaphore if the interprocess_semaphore's value is greater than zero //!and returns true. If the value is not greater than zero returns false. //!If there is an error an interprocess_exception exception is thrown. bool try_wait(); //!Decrements the interprocess_semaphore if the interprocess_semaphore's value is greater //!than zero and returns true. Otherwise, waits for the interprocess_semaphore //!to the posted or the timeout expires. If the timeout expires, the //!function returns false. If the interprocess_semaphore is posted the function //!returns true. If there is an error throws sem_exception bool timed_wait(const boost::posix_time::ptime &abs_time); //!Returns the interprocess_semaphore count // int get_count() const; /// @cond private: #if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION) interprocess_mutex m_mut; interprocess_condition m_cond; int m_count; #else detail::semaphore_wrapper m_sem; #endif //#if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION) /// @endcond }; } //namespace interprocess { } //namespace boost { #ifdef BOOST_INTERPROCESS_USE_GENERIC_EMULATION # undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION # include
#endif #ifdef BOOST_INTERPROCESS_USE_POSIX # undef BOOST_INTERPROCESS_USE_POSIX # include
#endif #include
#endif //BOOST_INTERPROCESS_SEMAPHORE_HPP
interprocess_semaphore.hpp
Page URL
File URL
Prev
6/18
Next
Download
( 4 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.