hphp/hack/src/heap/hh_shared.c
/* Must be called by every worker before any operation is performed */
Must be called by every worker before any operation is performed
Must be called by every worker before any operation is performed
value hh_connect(value connector, value is_master) {
  CAMLparam2(connector, is_master);
  memfd = Handle_val(Field(connector, 0));
  set_sizes(
    Long_val(Field(connector, 1)),
    Long_val(Field(connector, 2)),
    Long_val(Field(connector, 3)),
    Long_val(Field(connector, 4))
  );
#ifdef _WIN32
  my_pid = 1; 
#else
  my_pid = getpid();
#endif
  char *shared_mem_init = memfd_map(shared_mem_size);
  define_globals(shared_mem_init);
  if (Bool_val(is_master)) {
    *master_pid = my_pid;
  }
  CAMLreturn(Val_unit);
}
value hh_connect ( value connector , value is_master ) { CAMLparam2 ( connector , is_master ) ; memfd = Handle_val ( Field ( connector , 0 ) ) ; set_sizes ( Long_val ( Field ( connector , 1 ) ) , Long_val ( Field ( connector , 2 ) ) , Long_val ( Field ( connector , 3 ) ) , Long_val ( Field ( connector , 4 ) ) ) ; #ifdef _WIN32 my_pid = 1 ; #else my_pid = getpid ( ) ; #endif char * shared_mem_init = memfd_map ( shared_mem_size ) ; define_globals ( shared_mem_init ) ; if ( Bool_val ( is_master ) ) { * master_pid = my_pid ; } CAMLreturn ( Val_unit ) ; }
Must be called by every worker before any operation is performed
Must be called by every worker before any operation is performed
// Trick