예제 #1
0
int rlSharedMemory::deleteSharedMemory()
{
#ifdef RLUNIX
    struct shmid_ds buf;
    if(status != OK) return -1;
    //rlwthread_mutex_destroy(mutex);
    flock(fdlock,LOCK_UN);
    shmctl(id, IPC_RMID, &buf);
    _size = 0;
    return 0;
#endif

#ifdef __VMS
    int ret;
    ADD add_in,add_ret;
    struct dsc$descriptor_s section_name;

    if(status != OK) return -1;
    rlwthread_mutex_destroy(mutex);
    // Fill descriptor for section name
    section_name.dsc$w_length  = strlen(name);
    section_name.dsc$a_pointer = name;
    section_name.dsc$b_dtype   = DSC$K_DTYPE_T;
    section_name.dsc$b_class   = DSC$K_CLASS_S;
    // Delete the section
    ret = sys$dgblsc(0,&section_name,0);
    if(ret != SS$_NORMAL) return -1;
    // Fill the input address
    add_in.start = (long) base_adr;
    add_in.end   = (long) base_adr + _size;
    // Free the memory
    ret = sys$deltva(&add_in,&add_ret,0);
    if(ret != SS$_NORMAL) return -1;
    // Test the section addresses
    if(add_in.start != add_ret.start || add_in.end != add_ret.end) return -1;
    return 0;
#endif

#ifdef RLWIN32
    if(status != OK) return -1;
    //rlwthread_mutex_destroy(mutex);
    UnmapViewOfFile(base_adr);
    CloseHandle((HANDLE) id);
    CloseHandle((HANDLE) shmkey);
    UnlockFile(hSharedFile,0,0,_size,0); // Changed by FMakkinga 18-03-2013
    CloseHandle(hSharedFile);           // Changed by FMakkinga 18-03-2013
    status = ~OK;
    return 0;
#endif
}
예제 #2
0
파일: rlfifo.cpp 프로젝트: AugustXiao/pvb
rlFifo::~rlFifo()
{
MessageList *ptr,*lastptr;

  ptr = list;
  if(ptr != NULL)
  {
    do
    {
      lastptr = ptr;
      ptr = ptr->next;
      delete [] lastptr->mes;
      delete lastptr;
    }
    while(ptr != NULL);
  }
  rlwthread_mutex_destroy(&mutex);
  rlwrapdestroy_semaphore(&semaphore);
}
예제 #3
0
파일: rlthread.cpp 프로젝트: 376473984/pvb
rlMutex::~rlMutex()
{
  rlwthread_mutex_destroy(&mutex);
}
예제 #4
0
파일: rlthread.cpp 프로젝트: 376473984/pvb
rlThread::~rlThread()
{
  arg.running = 0;
  rlwthread_mutex_destroy(&mutex);
  rlwrapdestroy_semaphore(&semaphore);
}