#include "JLang/JMutex.hh"
#include <iostream>
#include <stdexcept>
#include <cstdlib>
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
 
Go to the source code of this file.
 | 
| void  | withdraw (int &account, int amount) | 
|   | 
| void  | deposit (int &account, int amount) | 
|   | 
| int  | main (int argc, char **argv) | 
|   | 
◆ withdraw()
      
        
          | void withdraw  | 
          ( | 
          int &  | 
          account,  | 
        
        
           | 
           | 
          int  | 
          amount  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 16 of file JMutex.cc.
   19     throw std::runtime_error(
"Wrong amount!");
 
   22     throw std::runtime_error(
"Your account can't provide the requested amount!");
 
 
 
 
◆ deposit()
      
        
          | void deposit  | 
          ( | 
          int &  | 
          account,  | 
        
        
           | 
           | 
          int  | 
          amount  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 27 of file JMutex.cc.
   30     throw std::runtime_error(
"Wrong amount!");
 
 
 
 
◆ main()
      
        
          | int main  | 
          ( | 
          int  | 
          argc,  | 
        
        
           | 
           | 
          char **  | 
          argv  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 35 of file JMutex.cc.
   43     JParser<> zap(
"Example program to test mutex messaging.");
 
   49   catch(
const exception &error) {
 
   50     FATAL(error.what() << endl);
 
   56   cout << 
"Trying to deposit 1000 eur\n";
 
   63   cout << 
"Trying to put a negative amount\n";
 
   68   } 
catch (runtime_error 
const& e) {
 
   69     cout << e.what() << 
'\n';
 
   72   cout << 
"Let the wife do shopping\n";
 
   78       int const cost = rand() % 100;
 
   79       cout << 
"Paying " << cost << 
"for something\n";
 
   82   } 
catch (runtime_error 
const& e) {
 
   83     cout << e.what() << 
'\n';
 
void withdraw(int &account, int amount)
 
void deposit(int &account, int amount)
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Utility class to parse command line options.