112943Sgabeblack@google.com/*
212943Sgabeblack@google.com * Copyright 2018 Google, Inc.
312943Sgabeblack@google.com *
412943Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
512943Sgabeblack@google.com * modification, are permitted provided that the following conditions are
612943Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
712943Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
812943Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
912943Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1012943Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1112943Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1212943Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1312943Sgabeblack@google.com * this software without specific prior written permission.
1412943Sgabeblack@google.com *
1512943Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1612943Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1712943Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1812943Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1912943Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2012943Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2112943Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2212943Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2312943Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2412943Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2512943Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2612943Sgabeblack@google.com *
2712943Sgabeblack@google.com * Authors: Gabe Black
2812943Sgabeblack@google.com */
2912943Sgabeblack@google.com
3012943Sgabeblack@google.com#ifndef __SYSTEMC_EXT_CORE_SC_JOIN_HH__
3112943Sgabeblack@google.com#define __SYSTEMC_EXT_CORE_SC_JOIN_HH__
3212943Sgabeblack@google.com
3313196Sgabeblack@google.com#include "sc_event.hh"
3412943Sgabeblack@google.com#include "sc_process_handle.hh"
3512943Sgabeblack@google.com
3612943Sgabeblack@google.comnamespace sc_core
3712943Sgabeblack@google.com{
3812943Sgabeblack@google.com
3912943Sgabeblack@google.com// Nonstandard
4012943Sgabeblack@google.comtypedef sc_process_b *sc_thread_handle;
4112943Sgabeblack@google.com
4212943Sgabeblack@google.com// Nonstandard
4312943Sgabeblack@google.comclass sc_join
4412943Sgabeblack@google.com{
4512943Sgabeblack@google.com  public:
4612943Sgabeblack@google.com    sc_join();
4713196Sgabeblack@google.com
4812943Sgabeblack@google.com    void add_process(sc_process_handle);
4912943Sgabeblack@google.com    int process_count();
5013196Sgabeblack@google.com    void signal();
5112943Sgabeblack@google.com    void wait();
5212943Sgabeblack@google.com    void wait_clocked();
5313196Sgabeblack@google.com
5413196Sgabeblack@google.com  private:
5513303Sgabeblack@google.com    sc_gem5::InternalScEvent joinEvent;
5613196Sgabeblack@google.com    int remaining;
5712943Sgabeblack@google.com};
5812943Sgabeblack@google.com
5912943Sgabeblack@google.com} // namespace sc_core
6012943Sgabeblack@google.com
6112943Sgabeblack@google.com#endif  //__SYSTEMC_EXT_CORE_SC_JOIN_HH__
62