// // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // Waitfor.cc -- // // Author : Thierry Delisle // Created On : Mon Aug 28 11:06:52 2017 // Last Modified By : // Last Modified On : // Update Count : 5 // #include "Concurrency/Keywords.h" #include // for assert #include // for string, operator== using namespace std::string_literals; #include "Common/PassVisitor.h" // for PassVisitor #include "Common/SemanticError.h" // for SemanticError #include "Common/utility.h" // for deleteAll, map_range #include "CodeGen/OperatorTable.h" // for isConstructor #include "InitTweak/InitTweak.h" // for getPointerBase #include "Parser/LinkageSpec.h" // for Cforall #include "ResolvExpr/Resolver.h" // for findVoidExpression #include "SynTree/Constant.h" // for Constant #include "SynTree/Declaration.h" // for StructDecl, FunctionDecl, ObjectDecl #include "SynTree/Expression.h" // for VariableExpr, ConstantExpr, Untype... #include "SynTree/Initializer.h" // for SingleInit, ListInit, Initializer ... #include "SynTree/Label.h" // for Label #include "SynTree/Statement.h" // for CompoundStmt, DeclStmt, ExprStmt #include "SynTree/Type.h" // for StructInstType, Type, PointerType #include "SynTree/Visitor.h" // for Visitor, acceptAll class Attribute; /* void foo() { while( true ) { when( a < 1 ) waitfor( f, a ) { bar(); } or timeout( swagl() ); or waitfor( g, a ) { baz(); } or waitfor( ^?{}, a ) { break; } or waitfor( ^?{} ) { break; } } } void f(int i, float f, A & mutex b, struct foo * ); void f(int ); | | | | | | | | | | \ | | / \ / \ / \/ void foo() { while( true ) { acceptable_t acceptables[3]; if( a < 1 ) { acceptables[0].func = f; acceptables[0].mon = a; } acceptables[1].func = g; acceptables[1].mon = a; acceptables[2].func = f; acceptables[2].mon = a; acceptables[2].is_dtor = true; int ret = waitfor_internal( acceptables, swagl() ); switch( ret ) { case 0: { bar(); } case 1: { baz(); } case 2: signal(a); { break; } } } }*/ namespace Concurrency { namespace { const std::list