| 1 | // interprocess test.cpp : Defines the entry point for the console application.
|
|---|
| 2 | //
|
|---|
| 3 |
|
|---|
| 4 | //#include "stdafx.h"
|
|---|
| 5 | #define BOOST_DATE_TIME_NO_LIB
|
|---|
| 6 | #include "boost\interprocess\sync\named_mutex.hpp"
|
|---|
| 7 | #include <string>
|
|---|
| 8 | #include <iostream>
|
|---|
| 9 |
|
|---|
| 10 | using namespace boost::interprocess;
|
|---|
| 11 | using namespace std;
|
|---|
| 12 |
|
|---|
| 13 | int main(int argc, char argv[])
|
|---|
| 14 | {
|
|---|
| 15 | try
|
|---|
| 16 | {
|
|---|
| 17 | named_mutex nm(create_only,"testmtx");
|
|---|
| 18 | }
|
|---|
| 19 | catch(interprocess_exception &ex){
|
|---|
| 20 | cout<< ex.what() <<endl;
|
|---|
| 21 | }
|
|---|
| 22 | string s;
|
|---|
| 23 | cin>> s;// pause to allow hibernation
|
|---|
| 24 | try{
|
|---|
| 25 | named_mutex nm(open_or_create,"testmtx");
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | catch(interprocess_exception &ex){
|
|---|
| 29 | cout<< ex.what() <<endl;
|
|---|
| 30 | }
|
|---|
| 31 | return 0;
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|