Exemple #1
0
THMapAllocatorContext *THMapAllocatorContext_newWithFd(const char *filename, int fd, int flags)
{
  THMapAllocatorContext *ctx = THMapAllocatorContext_new(filename, flags);
  ctx->fd = fd;

  return ctx;
}
Exemple #2
0
static THStorage* THPStorage_(newFdStorage)(ptrdiff_t size)
{
  int flags = TH_ALLOCATOR_MAPPED_SHAREDMEM |
              TH_ALLOCATOR_MAPPED_EXCLUSIVE |
              TH_ALLOCATOR_MAPPED_KEEPFD |
              TH_ALLOCATOR_MAPPED_UNLINK;
  std::string handle = THPStorage_(__newHandle)();
  auto ctx = THMapAllocatorContext_new(handle.c_str(), flags);
  return THStorage_(newWithAllocator)(size, &THMapAllocator, (void*)ctx);
}
Exemple #3
0
THMapAllocatorContext *THMapAllocatorContext_newWithFd(const char *filename, int fd, int flags)
{
#ifdef _WIN32
  THError("THMapAllocatorContext_newWithFd is unsupported on Windows");
#else
  THMapAllocatorContext *ctx = THMapAllocatorContext_new(filename, flags);
  ctx->fd = fd;

  return ctx;
#endif
}
Exemple #4
0
libshm_context * libshm_context_new(const char *manager_handle, const char *filename, int flags) {
  libshm_context *ctx = new libshm_context();
  ctx->manager_handle = "no_manager";
  ctx->th_context = THMapAllocatorContext_new(filename, flags);
  return ctx;
}