You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/08/12 15:23:22 UTC
svn commit: r803495 - in /commons/sandbox/runtime/trunk/src/main/native/os:
unix/ios.c win32/ios.c
Author: mturk
Date: Wed Aug 12 13:23:21 2009
New Revision: 803495
URL: http://svn.apache.org/viewvc?rev=803495&view=rev
Log:
use null_tab for setting the closed descriptor
Modified:
commons/sandbox/runtime/trunk/src/main/native/os/unix/ios.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/ios.c
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/ios.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/ios.c?rev=803495&r1=803494&r2=803495&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/ios.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/ios.c Wed Aug 12 13:23:21 2009
@@ -28,7 +28,7 @@
#define __SET_BMP(X, B) __bitmap[(X)] |= __zero_bit_mask[(B) & 0x07]
#define __CLR_BMP(X, B) __bitmap[(X)] &= __ones_bit_mask[(B) & 0x07]
-static acr_ioh nul_ioh_tab = { INVALID_HANDLE_VALUE };
+static acr_ioh nul_ioh_tab = { INVALID_HANDLE_VALUE };
acr_ioh *acr_ioh_tab = &nul_ioh_tab;
int acr_ioh_mask;
@@ -36,7 +36,7 @@
static unsigned char *__bitmap;
static int __ioh_size;
static int __bmp_size;
-static int __bmp_hint;
+static volatile int __bmp_hint;
static const unsigned char __zero_bit_mask[] = {
0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
@@ -111,7 +111,7 @@
acr_ioh_mask = __ioh_size - 1;
acr_ioh_tab = (acr_ioh *)calloc(sizeof(acr_ioh), __ioh_size);
if (acr_ioh_tab) {
- acr_ioh_tab[acr_ioh_mask].h = INVALID_HANDLE_VALUE;
+ acr_ioh_tab[acr_ioh_mask] = nul_ioh_tab;
}
else {
acr_ioh_mask = 0;
@@ -244,10 +244,7 @@
return ACR_ENOMEM;
pthread_mutex_lock(&ios_lock);
- acr_ioh_tab[i].h = INVALID_HANDLE_VALUE;
- acr_ioh_tab[i].c = NULL;
- acr_ioh_tab[i].type = ACR_DT_UNKNOWN;
- acr_ioh_tab[i].flags = 0;
+ acr_ioh_tab[i] = nul_ioh_tab;
__CLR_BIT(__bitmap, i);
pthread_mutex_unlock(&ios_lock);
@@ -268,10 +265,7 @@
acr_ioh_tab[i].flags);
}
pthread_mutex_lock(&ios_lock);
- acr_ioh_tab[i].h = INVALID_HANDLE_VALUE;
- acr_ioh_tab[i].c = NULL;
- acr_ioh_tab[i].type = ACR_DT_UNKNOWN;
- acr_ioh_tab[i].flags = 0;
+ acr_ioh_tab[i] = nul_ioh_tab;
__CLR_BIT(__bitmap, i);
pthread_mutex_unlock(&ios_lock);
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/ios.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/ios.c?rev=803495&r1=803494&r2=803495&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/ios.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/ios.c Wed Aug 12 13:23:21 2009
@@ -27,7 +27,7 @@
#define __SET_BMP(X, B) __bitmap[(X)] |= __zero_bit_mask[(B) & 0x07]
#define __CLR_BMP(X, B) __bitmap[(X)] &= __ones_bit_mask[(B) & 0x07]
-static acr_ioh nul_ioh_tab = { INVALID_HANDLE_VALUE };
+static acr_ioh nul_ioh_tab = { INVALID_HANDLE_VALUE };
acr_ioh *acr_ioh_tab = &nul_ioh_tab;
int acr_ioh_mask;
@@ -35,7 +35,7 @@
static unsigned char *__bitmap;
static int __ioh_size;
static int __bmp_size;
-static int __bmp_hint;
+static volatile int __bmp_hint;
static const unsigned char __zero_bit_mask[] = {
0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
@@ -87,7 +87,7 @@
acr_ioh_mask = __ioh_size - 1;
acr_ioh_tab = (acr_ioh *)calloc(sizeof(acr_ioh), __ioh_size);
if (acr_ioh_tab) {
- acr_ioh_tab[acr_ioh_mask].h = INVALID_HANDLE_VALUE;
+ acr_ioh_tab[acr_ioh_mask] = nul_ioh_tab;
}
else {
acr_ioh_mask = 0;
@@ -221,10 +221,7 @@
return ACR_ENOMEM;
EnterCriticalSection(&ios_lock);
- acr_ioh_tab[i].h = INVALID_HANDLE_VALUE;
- acr_ioh_tab[i].c = NULL;
- acr_ioh_tab[i].type = ACR_DT_UNKNOWN;
- acr_ioh_tab[i].flags = 0;
+ acr_ioh_tab[i] = nul_ioh_tab;
__CLR_BIT(__bitmap, i);
LeaveCriticalSection(&ios_lock);
@@ -245,10 +242,7 @@
acr_ioh_tab[i].flags);
}
EnterCriticalSection(&ios_lock);
- acr_ioh_tab[i].h = INVALID_HANDLE_VALUE;
- acr_ioh_tab[i].c = NULL;
- acr_ioh_tab[i].type = ACR_DT_UNKNOWN;
- acr_ioh_tab[i].flags = 0;
+ acr_ioh_tab[i] = nul_ioh_tab;
__CLR_BIT(__bitmap, i);
LeaveCriticalSection(&ios_lock);