MCPcopy Create free account
hub / github.com/PABannier/bark.cpp / close

Method close

examples/server/httplib.h:2618–2646  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2616inline const char *mmap::data() const { return (const char *)addr_; }
2617
2618inline void mmap::close() {
2619#if defined(_WIN32)
2620 if (addr_) {
2621 ::UnmapViewOfFile(addr_);
2622 addr_ = nullptr;
2623 }
2624
2625 if (hMapping_) {
2626 ::CloseHandle(hMapping_);
2627 hMapping_ = NULL;
2628 }
2629
2630 if (hFile_ != INVALID_HANDLE_VALUE) {
2631 ::CloseHandle(hFile_);
2632 hFile_ = INVALID_HANDLE_VALUE;
2633 }
2634#else
2635 if (addr_ != nullptr) {
2636 munmap(addr_, size_);
2637 addr_ = nullptr;
2638 }
2639
2640 if (fd_ != -1) {
2641 ::close(fd_);
2642 fd_ = -1;
2643 }
2644#endif
2645 size_ = 0;
2646}
2647inline int close_socket(socket_t sock) {
2648#ifdef _WIN32
2649 return closesocket(sock);

Callers 6

bark_model_quantizeFunction · 0.80
convert.pyFile · 0.80
bark_model_quantizeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected