当前位置: 首页>>代码示例>>C++>>正文


C++ delete_sem函数代码示例

本文整理汇总了C++中delete_sem函数的典型用法代码示例。如果您正苦于以下问题:C++ delete_sem函数的具体用法?C++ delete_sem怎么用?C++ delete_sem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了delete_sem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: device_close

status_t
device_close(void *data)
{
	struct sis_info *info;

	if (checkDeviceInfo(info = data) != B_OK)
		return EINVAL;

	info->cookieMagic = SiS_FREE_COOKIE_MAGIC;

	// cancel timer
	cancel_timer(&info->timer);

	// remove & disable interrupt
	sis900_disableInterrupts(info);
	remove_io_interrupt_handler(info->pciInfo->u.h0.interrupt_line, sis900_interrupt, info);

	// disable the transmitter's and receiver's state machine
	write32(info->registers + SiS900_MAC_COMMAND,
		SiS900_MAC_CMD_Rx_DISABLE | SiS900_MAC_CMD_Tx_DISABLE);

	delete_sem(info->rxSem);
	delete_sem(info->txSem);

#ifdef EXCESSIVE_DEBUG
	delete_sem(gIOLock);
#endif

	return B_OK;
}
开发者ID:luciang,项目名称:haiku,代码行数:30,代码来源:device.c

示例2: _thread_rw_cleanup

static apr_status_t _thread_rw_cleanup(void * data)
{
    apr_thread_rwlock_t *mutex = (apr_thread_rwlock_t*)data;

    if (mutex->ReadCount != 0) {
    	while (atomic_add(&mutex->ReadCount , -1) > 1){
            release_sem (mutex->Read);
    	}
    }
    if (mutex->WriteCount != 0) {
    	while (atomic_add(&mutex->WriteCount , -1) > 1){
            release_sem (mutex->Write);
    	}
    }
    if (mutex->LockCount != 0) {
    	while (atomic_add(&mutex->LockCount , -1) > 1){
            release_sem (mutex->Lock);
    	}
    }
    
    delete_sem(mutex->Read);
    delete_sem(mutex->Write);
    delete_sem(mutex->Lock);
    return APR_SUCCESS;
}    
开发者ID:0jpq0,项目名称:kbengine,代码行数:25,代码来源:thread_rwlock.c

示例3: delete_sem

void
MediaView::Reset()
{
	delete_sem(fPlaySem);
	fPlaySem = B_ERROR;

	delete_sem(fScrubSem);
	fScrubSem = B_ERROR;

	status_t result = B_NO_ERROR;
	wait_for_thread(fPlayerThread, &result);
	fPlayerThread = B_ERROR;

	fVideoTrack = NULL;

	fAudioTrack = NULL;

	delete (fAudioOutput);
	fAudioOutput = NULL;

	delete (fBitmap);
	fBitmap = NULL;

	delete (fMediaFile);
	fMediaFile = NULL;

	free(fAudioDumpingBuffer);
	fAudioDumpingBuffer = NULL;
}
开发者ID:HaikuArchives,项目名称:Resourcer,代码行数:29,代码来源:MediaView.cpp

示例4: while

void
BDirectWindow::_DisposeData()
{
	// wait until the connection terminates: we can't destroy
	// the object until the client receives the B_DIRECT_STOP
	// notification, or bad things will happen
	while (fConnectionEnable)
		snooze(50000);

	_LockDirect();

	if (fInitStatus & DW_STATUS_THREAD_STARTED) {
		fDaemonKiller = true;
		// delete this sem, otherwise the Direct daemon thread
		// will wait forever on it
		delete_sem(fDisableSem);
		status_t retVal;
		wait_for_thread(fDirectDaemonId, &retVal);
	}

#if DW_NEEDS_LOCKING
	if (fInitStatus & DW_STATUS_SEM_CREATED)
		delete_sem(fDirectSem);
#endif

	if (fInitStatus & DW_STATUS_AREA_CLONED)
		delete_area(fClonedClippingArea);
}
开发者ID:mmanley,项目名称:Antares,代码行数:28,代码来源:DirectWindow.cpp

示例5: wait_for_thread

// destructor
NetFSServer::~NetFSServer()
{
	fTerminating = true;
	// stop the connection listener
	if (fConnectionListener)
		fConnectionListener->StopListening();
	if (fConnectionListenerThread >= 0) {
		int32 result;
		wait_for_thread(fConnectionListenerThread, &result);
	}
	delete fConnectionListener;

	// delete the broadcaster semaphore
	if (fBroadcasterSemaphore >= 0)
		delete_sem(fBroadcasterSemaphore);

	// terminate the broadcaster
	if (fBroadcaster >= 0) {
		safe_closesocket(fBroadcastingSocket);

		// interrupt the thread in case it is currently snoozing
		suspend_thread(fBroadcaster);
		int32 result;
		wait_for_thread(fBroadcaster, &result);
	}

	// terminate the server info connection listener
	_ExitServerInfoConnectionListener();

	// terminate the connection deleter
	if (fClosedConnectionsSemaphore >= 0)
		delete_sem(fClosedConnectionsSemaphore);
	if (fConnectionDeleter >= 0) {
		int32 result;
		wait_for_thread(fConnectionDeleter, &result);
	}

	// blow away all remaining connections
	AutoLocker<Locker> _(fLock);
	// open connections
	for (int32 i = 0;
		 ClientConnection* connection
		 	= (ClientConnection*)fClientConnections.ItemAt(i);
		 i++) {
		connection->Close();
		delete connection;
	}

	// closed connections
	for (int32 i = 0;
		 ClientConnection* connection
		 	= (ClientConnection*)fClosedConnections.ItemAt(i);
		 i++) {
		delete connection;
	}
	VolumeManager::DeleteDefault();
	FDManager::DeleteDefault();
	delete fSecurityContext;
}
开发者ID:luciang,项目名称:haiku,代码行数:60,代码来源:NetFSServer.cpp

示例6: delete_sem

// destructor
RWLocker::~RWLocker()
{
	fLock.Lock();
	delete_sem(fMutex.semaphore);
	delete_sem(fQueue.semaphore);
	for (int32 i = 0; ReadLockInfo* info = _ReadLockInfoAt(i); i++)
		delete info;
}
开发者ID:mmanley,项目名称:Antares,代码行数:9,代码来源:RWLocker.cpp

示例7: create_sem

void
LegacyAudioConsumer::HandleStart( bigtime_t performance_time )
{
	if ( mRunning ) {
		return;
	}

	mPerformanceTimeBase = performance_time;

	//allocate buffer available semaphore
	mBuffer_avail = create_sem( 0, "legacy audio out buffer avail" );

	if ( mBuffer_avail < B_OK ) {
		goto init_err1;
	}

	//allocate buffer free semaphore
	mBuffer_free = create_sem( 1, "legacy audio out buffer free" );
	
	if ( mBuffer_free < B_OK ) {
		goto init_err2;
	}

	//allocate output completion semaphore
	mBuffer_waitIO = create_sem( 1, "legacy audio out waitIO" );

	if ( mBuffer_waitIO < B_OK ) {
		goto init_err3;
	}

	//tell the driver about the playback completion semaphore
	DRIVER_SET_PLAYBACK_COMPLETION_SEM( &mBuffer_waitIO, 0 );

	mThread = spawn_thread( _run_thread_, "legacy audio output", B_REAL_TIME_PRIORITY, this );

	if ( mThread < B_OK ) {
		goto init_err4;
	}

	io_buf = io_buf1;

	resume_thread( mThread );

	mRunning = true;
	return;

init_err4:
	delete_sem( mBuffer_waitIO );

init_err3:
	delete_sem( mBuffer_free );

init_err2:
	delete_sem( mBuffer_avail );

init_err1:
	return;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:58,代码来源:LegacyAudioConsumer.cpp

示例8: delete_area

DirectWindowInfo::~DirectWindowInfo()
{
	// this should make the client die in case it's still running
	fBufferInfo->bits = NULL;
	fBufferInfo->bytes_per_row = 0;

	delete_area(fBufferArea);
	delete_sem(fSem);
	delete_sem(fAcknowledgeSem);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:10,代码来源:DirectWindowInfo.cpp

示例9: closeManagedData

void closeManagedData(bt_managed_data *data)
{
	data->readCount = data->writeCount = 0;

	delete_sem(data->writer);
	delete_sem(data->reader);
	delete_sem(data->readerQueue);
	delete_sem(data->writeCountSem);
	delete_sem(data->readCountSem);
}
开发者ID:HaikuArchives,项目名称:BeServed,代码行数:10,代码来源:readerWriter.c

示例10: release_sem

WorkQueue::~WorkQueue()
{
	release_sem(fThreadCancel);

	status_t result;
	wait_for_thread(fThread, &result);

	mutex_destroy(&fQueueLock);
	delete_sem(fThreadCancel);
	delete_sem(fQueueSemaphore);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:11,代码来源:WorkQueue.cpp

示例11: usb_disk_free_device_and_luns

void
usb_disk_free_device_and_luns(disk_device *device)
{
	mutex_lock(&device->lock);
	mutex_destroy(&device->lock);
	delete_sem(device->notify);
	delete_sem(device->interruptLock);
	for (uint8 i = 0; i < device->lun_count; i++)
		free(device->luns[i]);
	free(device->luns);
	free(device);
}
开发者ID:Karvjorm,项目名称:haiku,代码行数:12,代码来源:usb_disk.cpp

示例12: hpet_open

status_t
hpet_open(const char* name, uint32 flags, void** cookie)
{
	*cookie = NULL;

	if (sHPETRegs == NULL)
		return B_NO_INIT;

	if (atomic_add(&sOpenCount, 1) != 0) {
		atomic_add(&sOpenCount, -1);
		return B_BUSY;
	}

	int timerNumber = 2;
		// TODO

	char semName[B_OS_NAME_LENGTH];
	snprintf(semName, B_OS_NAME_LENGTH, "hpet_timer %d sem", timerNumber);
	sem_id sem = create_sem(0, semName);
	if (sem < 0) {
		atomic_add(&sOpenCount, -1);
		return sem;
	}

	hpet_timer_cookie* hpetCookie = (hpet_timer_cookie*)malloc(sizeof(hpet_timer_cookie));
	if (hpetCookie == NULL) {
		delete_sem(sem);
		atomic_add(&sOpenCount, -1);
		return B_NO_MEMORY;
	}

	hpetCookie->number = timerNumber;
	hpetCookie->timer = &sHPETRegs->timer[timerNumber];
	hpetCookie->sem = sem;
	set_sem_owner(hpetCookie->sem, B_SYSTEM_TEAM);

	hpet_set_enabled(false);

	status_t status = hpet_init_timer(hpetCookie);
	if (status != B_OK)
		dprintf("hpet_open: initializing timer failed: %s\n", strerror(status));

	hpet_set_enabled(true);

	*cookie = hpetCookie;

	if (status != B_OK) {
		delete_sem(sem);
		free(hpetCookie);
		atomic_add(&sOpenCount, -1);
	}
	return status;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:53,代码来源:hpet.cpp

示例13: delete_sem

DavicomDevice::~DavicomDevice()
{
	if (fNotifyReadSem >= B_OK)
		delete_sem(fNotifyReadSem);
	if (fNotifyWriteSem >= B_OK)
		delete_sem(fNotifyWriteSem);
	
	if (!fRemoved) //???
		gUSBModule->cancel_queued_transfers(fNotifyEndpoint);

	if(fNotifyBuffer)
		free(fNotifyBuffer);
}
开发者ID:mmanley,项目名称:Antares,代码行数:13,代码来源:DavicomDevice.cpp

示例14: PR_DestroyCondVar

    PR_DestroyCondVar (PRCondVar *cvar)
{
    status_t result = delete_sem( cvar->sem );
    PR_ASSERT( result == B_NO_ERROR );
    
    result = delete_sem( cvar->handshakeSem );
    PR_ASSERT( result == B_NO_ERROR );

    result = delete_sem( cvar->signalSem );
    PR_ASSERT( result == B_NO_ERROR );

    PR_DELETE( cvar );
}
开发者ID:diversys,项目名称:bezilla,代码行数:13,代码来源:btcvar.c

示例15: remove_device

void
remove_device(pegasus_dev *device)
{
	ASSERT(device != NULL);

	delete_sem(device->rx_sem);
	delete_sem(device->tx_sem);
	delete_sem(device->rx_sem_cb);
	delete_sem(device->tx_sem_cb);

	delete_sem(device->sem_lock);

	free(device);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:14,代码来源:driver.c


注:本文中的delete_sem函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。