This commit is contained in:
Cloud Wu
2018-07-23 14:53:01 +08:00
parent 16f060f864
commit 1a0c9997ec
2 changed files with 3 additions and 2 deletions

View File

@@ -204,7 +204,7 @@ skynet_memalign(size_t alignment, size_t size) {
void *
skynet_aligned_alloc(size_t alignment, size_t size) {
void* ptr = je_aligned_alloc(alignment, size + (PREFIX_SIZE + alignment -1) & ~(alignment-1));
void* ptr = je_aligned_alloc(alignment, size + (size_t)((PREFIX_SIZE + alignment -1) & ~(alignment-1)));
if(!ptr) malloc_oom(size);
return fill_prefix(ptr);
}

View File

@@ -359,6 +359,7 @@ socket_server_create() {
s->type = SOCKET_TYPE_INVALID;
clear_wb_list(&s->high);
clear_wb_list(&s->low);
spinlock_init(&s->dw_lock);
}
ss->alloc_id = 0;
ss->event_n = 0;
@@ -429,6 +430,7 @@ socket_server_release(struct socket_server *ss) {
if (s->type != SOCKET_TYPE_RESERVE) {
force_close(ss, s, &l, &dummy);
}
spinlock_destroy(&s->dw_lock);
}
close(ss->sendctrl_fd);
close(ss->recvctrl_fd);
@@ -464,7 +466,6 @@ new_fd(struct socket_server *ss, int id, int fd, int protocol, uintptr_t opaque,
s->warn_size = 0;
check_wb_list(&s->high);
check_wb_list(&s->low);
spinlock_init(&s->dw_lock);
s->dw_buffer = NULL;
s->dw_size = 0;
return s;