nxt_runtime.c (1545:78836321a126) nxt_runtime.c (1548:a745db447e56)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_main.h>

--- 1363 unchanged lines hidden (view full) ---

1372
1373 if (nxt_slow_path(process == NULL)) {
1374 return NULL;
1375 }
1376
1377 nxt_queue_init(&process->ports);
1378
1379 nxt_thread_mutex_create(&process->incoming.mutex);
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_main.h>

--- 1363 unchanged lines hidden (view full) ---

1372
1373 if (nxt_slow_path(process == NULL)) {
1374 return NULL;
1375 }
1376
1377 nxt_queue_init(&process->ports);
1378
1379 nxt_thread_mutex_create(&process->incoming.mutex);
1380 nxt_thread_mutex_create(&process->outgoing.mutex);
1381 nxt_thread_mutex_create(&process->cp_mutex);
1382
1383 process->use_count = 1;
1384
1385 return process;
1386}
1387
1388
1389void
1390nxt_runtime_process_release(nxt_runtime_t *rt, nxt_process_t *process)
1391{
1392 if (process->registered == 1) {
1393 nxt_runtime_process_remove(rt, process);
1394 }
1395
1396 nxt_assert(process->use_count == 0);
1397 nxt_assert(process->registered == 0);
1398
1399 nxt_port_mmaps_destroy(&process->incoming, 1);
1380 nxt_thread_mutex_create(&process->cp_mutex);
1381
1382 process->use_count = 1;
1383
1384 return process;
1385}
1386
1387
1388void
1389nxt_runtime_process_release(nxt_runtime_t *rt, nxt_process_t *process)
1390{
1391 if (process->registered == 1) {
1392 nxt_runtime_process_remove(rt, process);
1393 }
1394
1395 nxt_assert(process->use_count == 0);
1396 nxt_assert(process->registered == 0);
1397
1398 nxt_port_mmaps_destroy(&process->incoming, 1);
1400 nxt_port_mmaps_destroy(&process->outgoing, 1);
1401
1402 nxt_thread_mutex_destroy(&process->incoming.mutex);
1399
1400 nxt_thread_mutex_destroy(&process->incoming.mutex);
1403 nxt_thread_mutex_destroy(&process->outgoing.mutex);
1404 nxt_thread_mutex_destroy(&process->cp_mutex);
1405
1406 /* processes from nxt_runtime_process_get() have no memory pool */
1407 if (process->mem_pool != NULL) {
1408 nxt_mp_destroy(process->mem_pool);
1409 }
1410
1411 nxt_mp_free(rt->mem_pool, process);

--- 294 unchanged lines hidden ---
1401 nxt_thread_mutex_destroy(&process->cp_mutex);
1402
1403 /* processes from nxt_runtime_process_get() have no memory pool */
1404 if (process->mem_pool != NULL) {
1405 nxt_mp_destroy(process->mem_pool);
1406 }
1407
1408 nxt_mp_free(rt->mem_pool, process);

--- 294 unchanged lines hidden ---