Ignore:
Timestamp:
Mar 2, 2021, 5:21:35 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
10dafa4
Parents:
0f9c010b
Message:

add concurrency lock to IO stream and provide user interface to lock stream

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/fstream.hfa

    r0f9c010b re474cf09  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 19 16:29:17 2020
    13 // Update Count     : 189
     12// Last Modified On : Mon Mar  1 22:45:08 2021
     13// Update Count     : 217
    1414//
    1515
    1616#pragma once
    1717
    18 #include "bits/weakso_locks.hfa"
     18#include "bits/weakso_locks.hfa"                                                // mutex_lock
    1919#include "iostream.hfa"
    2020#include <exception.hfa>
     
    3535        char $separator[sepSize];
    3636        char $tupleSeparator[sepSize];
    37 //      multiple_acquisition_lock lock;
     37        multiple_acquisition_lock $lock;
     38        bool $acquired;
    3839}; // ofstream
    3940
     
    7172ofstream & write( ofstream &, const char data[], size_t size );
    7273int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));
     74void acquire( ofstream & os );
     75void release( ofstream & os );
     76
     77struct osacquire {
     78        ofstream & os;
     79};
     80void ?{}( osacquire & acq, ofstream & os );
     81void ^?{}( osacquire & acq );
    7382
    7483void ?{}( ofstream & os );
     
    8796        void * $file;
    8897        bool $nlOnOff;
     98        multiple_acquisition_lock $lock;
     99        bool $acquired;
    89100}; // ifstream
    90101
     
    93104void nlOff( ifstream & );
    94105bool getANL( ifstream & );
     106void ends( ifstream & );
    95107int fail( ifstream & is );
    96108int eof( ifstream & is );
     
    101113ifstream & ungetc( ifstream & is, char c );
    102114int fmt( ifstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) ));
     115void acquire( ifstream & is );
     116void release( ifstream & is );
     117
     118struct isacquire {
     119        ifstream & is;
     120};
     121void ?{}( isacquire & acq, ifstream & is );
     122void ^?{}( isacquire & acq );
    103123
    104124void ?{}( ifstream & is );
Note: See TracChangeset for help on using the changeset viewer.