comparison src/event/ngx_event.c @ 2720:b3b8c66bd520

support attaching to an existent Win32 shared memory
author Igor Sysoev <igor@sysoev.ru>
date Sat, 18 Apr 2009 19:27:28 +0000
parents a472d954c534
children d43d73277c5c
comparison
equal deleted inserted replaced
2719:9237cf8b400b 2720:b3b8c66bd520
504 + cl; /* ngx_stat_writing */ 504 + cl; /* ngx_stat_writing */
505 505
506 #endif 506 #endif
507 507
508 shm.size = size; 508 shm.size = size;
509 shm.name.len = sizeof("nginx_shared_zone");
510 shm.name.data = (u_char *) "nginx_shared_zone";
509 shm.log = cycle->log; 511 shm.log = cycle->log;
510 512
511 if (ngx_shm_alloc(&shm) != NGX_OK) { 513 if (ngx_shm_alloc(&shm) != NGX_OK) {
512 return NGX_ERROR; 514 return NGX_ERROR;
513 } 515 }
533 ngx_stat_reading = (ngx_atomic_t *) (shared + 6 * cl); 535 ngx_stat_reading = (ngx_atomic_t *) (shared + 6 * cl);
534 ngx_stat_writing = (ngx_atomic_t *) (shared + 7 * cl); 536 ngx_stat_writing = (ngx_atomic_t *) (shared + 7 * cl);
535 537
536 #endif 538 #endif
537 539
538 *ngx_connection_counter = 1; 540 (void) ngx_atomic_cmp_set(ngx_connection_counter, 0, 1);
539 541
540 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0, 542 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
541 "counter: %p, %d", 543 "counter: %p, %d",
542 ngx_connection_counter, *ngx_connection_counter); 544 ngx_connection_counter, *ngx_connection_counter);
543 545