int NaClReverseThreadIfCtor_protected(
    struct NaClReverseCountingThreadInterface   *self,
    void                                        *factory_data,
    NaClThreadIfStartFunction                   fn_ptr,
    void                                        *thread_data,
    size_t                                      thread_stack_size) {
  struct NaClReverseService *nrsp = (struct NaClReverseService *) factory_data;

  NaClLog(3, "Entered NaClReverseThreadIfCtor_protected\n");
  if (!NaClThreadInterfaceCtor_protected(
          (struct NaClThreadInterface *) self,
          NaClReverseThreadIfFactoryFn,
          NaClRefCountRef((struct NaClRefCount *) nrsp),
          fn_ptr,
          thread_data,
          thread_stack_size)) {
    NaClLog(4, "NaClThreadInterfaceCtor_protected failed\n");
    NaClRefCountUnref((struct NaClRefCount *) nrsp);
    return 0;
  }

  self->reverse_service = nrsp;
  (*NACL_VTBL(NaClReverseService, nrsp)->ThreadCountIncr)(nrsp);

  NACL_VTBL(NaClRefCount, self) =
      (struct NaClRefCountVtbl *) &kNaClReverseThreadInterfaceVtbl;

  NaClLog(3, "Leaving NaClAddrSpSquattingThreadIfCtor_protected\n");
  return 1;
}
Esempio n. 2
0
int NaClAddrSpSquattingThreadIfCtor_protected(
    struct NaClAddrSpSquattingThreadInterface *self,
    void                                      *factory_data,
    NaClThreadIfStartFunction                 thread_fn_ptr,
    void                                      *thread_fn_data,
    size_t                                    thread_stack_size) {

  NaClLog(3, "Entered NaClAddrSpSquattingThreadIfCtor_protected\n");
  if (!NaClThreadInterfaceCtor_protected(
          (struct NaClThreadInterface *) self,
          NaClAddrSpSquattingThreadIfFactoryFunction,
          factory_data,  /* nap */
          thread_fn_ptr,
          thread_fn_data,
          thread_stack_size)) {
    NaClLog(3,
            ("NaClAddrSpSquattingThreadIfCtor_protected: placement base class"
             " ctor failed\n"));
    return 0;
  }

  self->nap = (struct NaClApp *) factory_data;
  NACL_VTBL(NaClRefCount, self) =
      (struct NaClRefCountVtbl *) &kNaClAddrSpSquattingThreadInterfaceVtbl;

  NaClLog(3, "Leaving NaClAddrSpSquattingThreadIfCtor_protected\n");
  return 1;
}