@@ -126,15 +126,17 @@ int Lock_destroy(struct agmdb_lock *db_lock) {
126126 rc =Lock_close (db_lock);
127127if (AGMDB_isError (rc))
128128return rc;
129- /* Windows doesn't do anything*/
130129#ifndef _WIN32
131130 rc =semctl (db_lock->sem_id ,0 , IPC_RMID);
132131if (rc == -1 )
133132return AGMDB_ERROR_LOCK_LINUX_SEM_DESTROY_FAIL;
134133else
135134 db_lock->sem_id = -1 ;
136- #endif
137135return AGMDB_SUCCESS;
136+ #else
137+ /* Locks destroy doesn't support on Windows*/
138+ return AGMDB_ERROR_LOCK_WIN_DESTROY_NOT_SUPPORT;
139+ #endif
138140}
139141
140142/* *
@@ -451,16 +453,19 @@ int SHM_destroy(struct agmdb_handler *dbm) {
451453 rc =SHM_close (dbm);
452454if (AGMDB_isError (rc))
453455return rc;
454- /* Windows doesn't do anything */
456+
455457#ifndef _WIN32
456458if (dbm->linux_shm_id != -1 ) {
457459 rc =shmctl (dbm->linux_shm_id , IPC_RMID,0 );
458460if (rc == -1 )
459461return AGMDB_ERROR_SHM_LINUX_DESTROY_FAIL;
460462 dbm->linux_shm_id = -1 ;
461463 }
462- #endif
463464return AGMDB_SUCCESS;
465+ #else
466+ /* Shared memory destroy doesn't support on Windows*/
467+ return AGMDB_ERROR_SHM_WIN_DESTROY_NOT_SUPPORT;
468+ #endif
464469}
465470
466471/* *
@@ -1124,6 +1129,11 @@ int AGMDB_destroyDB(struct agmdb_handler *dbm) {
11241129
11251130 rc_shm =SHM_destroy (dbm);
11261131 rc_lock =Lock_destroy (&(dbm->db_lock ));
1132+
1133+ /* Database destroy doesn't support on Windows*/
1134+ if (rc_shm == AGMDB_ERROR_SHM_WIN_DESTROY_NOT_SUPPORT && rc_lock == AGMDB_ERROR_LOCK_WIN_DESTROY_NOT_SUPPORT)
1135+ return AGMDB_ERROR_DB_WIN_DESTROY_NOT_SUPPORT;
1136+
11271137if (AGMDB_isError (rc_shm))
11281138return rc_shm;
11291139else if (AGMDB_isError (rc_lock))
@@ -1442,6 +1452,9 @@ const char* AGMDB_getErrorInfo(int error_no) {
14421452case AGMDB_ERROR_GETALL_ARRAY_TOO_SMALL:
14431453return " In getAll function, the array is too samll to save the data." ;
14441454
1455+ case AGMDB_ERROR_DB_WIN_DESTROY_NOT_SUPPORT:
1456+ return " In Windows system, the destroy operation doesn't supported. Just close the database." ;
1457+
14451458case AGMDB_ERROR_UNEXPECTED:
14461459return " Unexpected error happens." ;
14471460
@@ -1477,6 +1490,8 @@ const char* AGMDB_getErrorInfo(int error_no) {
14771490return " In Windows system, faild when close the shared memory handle. Call GetLastError() for more information." ;
14781491case AGMDB_ERROR_SHM_WIN_UNMAP_AND_CLOSE_HANDLE_FAIL:
14791492return " In Windows system, faild when unmap the shared memory and close the shared memory handle. Call GetLastError() for more information." ;
1493+ case AGMDB_ERROR_SHM_WIN_DESTROY_NOT_SUPPORT:
1494+ return " In Windows system, the shared memory destroy operation doesn't supported. Just close the shared memory." ;
14801495
14811496case AGMDB_ERROR_LOCK_OP_NEGATIVE_VAL:
14821497return " When operating the lock, the operation value is negative!" ;
@@ -1504,6 +1519,8 @@ const char* AGMDB_getErrorInfo(int error_no) {
15041519return " In Windows system, failed when releasing the mutex object." ;
15051520case AGMDB_ERROR_LOCK_WIN_CLOSE_MUTEX_FAIL:
15061521return " In Windows system, failed when close the mutex object." ;
1522+ case AGMDB_ERROR_LOCK_WIN_DESTROY_NOT_SUPPORT:
1523+ return " In Windows system, the lock destroy operation doesn't supported. Just close the locks." ;
15071524
15081525default :
15091526return " Error code is not found." ;