Ejemplo n.º 1
0
BoostContext::BoostContext(std::function<void()> code,
    void_pfn_smxprocess_t cleanup_func, smx_process_t process)
  : Context(std::move(code), cleanup_func, process)
{

  /* if the user provided a function for the process then use it,
     otherwise it is the context for maestro */
  if (has_code()) {
    this->stack_ = SIMIX_context_stack_new();
    // We need to pass the bottom of the stack to make_fcontext,
    // depending on the stack direction it may be the lower or higher address:
  #if PTH_STACKGROWTH == -1
    void* stack = (char*) this->stack_ + smx_context_usable_stack_size - 1;
  #else
    void* stack = this->stack_;
  #endif
    this->fc_ = boost::context::make_fcontext(
                      stack,
                      smx_context_usable_stack_size,
                      smx_ctx_boost_wrapper);
  } else {
    #if HAVE_BOOST_CONTEXTS == 1
    this->fc_ = new boost::context::fcontext_t();
    #endif
    if (BoostContext::maestro_context_ == nullptr)
      BoostContext::maestro_context_ = this;
  }
}
Ejemplo n.º 2
0
Context::Context(std::function<void()>&& code, actor::ActorImpl* actor) : code_(std::move(code)), actor_(actor)
{
  /* If no function was provided, this is the context for maestro
   * and we should set it as the current context */
  if (not has_code())
    set_current(this);
}
Ejemplo n.º 3
0
Context::Context(std::function<void()> code,
                 void_pfn_smxprocess_t cleanup_func, smx_actor_t process)
    : code_(std::move(code)), process_(process), iwannadie(false)
{
    /* If the user provided a function for the process then use it.
       Otherwise, it is the context for maestro and we should set it as the
       current context */
    if (has_code())
        this->cleanup_func_ = cleanup_func;
    else
        SIMIX_context_set_current(this);
}
Ejemplo n.º 4
0
void Shutdown_Res::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:Shutdown.Res)
  // required int32 code = 1;
  if (has_code()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->code(), output);
  }

  if (!unknown_fields().empty()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:Shutdown.Res)
}
Ejemplo n.º 5
0
::google::protobuf::uint8* Shutdown_Res::SerializeWithCachedSizesToArray(
    ::google::protobuf::uint8* target) const {
  // @@protoc_insertion_point(serialize_to_array_start:Shutdown.Res)
  // required int32 code = 1;
  if (has_code()) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->code(), target);
  }

  if (!unknown_fields().empty()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:Shutdown.Res)
  return target;
}
Ejemplo n.º 6
0
int Shutdown_Res::ByteSize() const {
  int total_size = 0;

  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // required int32 code = 1;
    if (has_code()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->code());
    }

  }
  if (!unknown_fields().empty()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        unknown_fields());
  }
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = total_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}