本文整理汇总了C++中delete_sem函数的典型用法代码示例。如果您正苦于以下问题:C++ delete_sem函数的具体用法?C++ delete_sem怎么用?C++ delete_sem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_sem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: delete_sem
void
LegacyAudioConsumer::HandleStop()
{
if ( ! mRunning ) {
return;
}
delete_sem( mBuffer_avail );
delete_sem( mBuffer_free );
delete_sem( mBuffer_waitIO );
wait_for_thread( mThread, &mThread );
mRunning = false;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:14,代码来源:LegacyAudioConsumer.cpp
示例17: Removed
SerialDevice::~SerialDevice()
{
Removed();
if (fDoneRead >= B_OK)
delete_sem(fDoneRead);
if (fDoneWrite >= B_OK)
delete_sem(fDoneWrite);
if (fBufferArea >= B_OK)
delete_area(fBufferArea);
mutex_destroy(&fReadLock);
mutex_destroy(&fWriteLock);
}
开发者ID:luciang,项目名称:haiku,代码行数:15,代码来源:SerialDevice.cpp
示例18: be_mouse_init
extern "C" int be_mouse_init(void)
{
sem_id mouse_started;
int32 num_buttons;
mouse_started = create_sem(0, "starting mouse driver...");
if (mouse_started < 0) {
goto cleanup;
}
mouse_thread_id = spawn_thread(mouse_thread, MOUSE_THREAD_NAME,
MOUSE_THREAD_PRIORITY, &mouse_started);
if (mouse_thread_id < 0) {
goto cleanup;
}
mouse_thread_running = true;
resume_thread(mouse_thread_id);
acquire_sem(mouse_started);
delete_sem(mouse_started);
be_mickey_x = 0;
be_mickey_y = 0;
be_mouse_x = 0;
be_mouse_y = 0;
be_mouse_b = 0;
limit_up = 0;
limit_down = 0;
limit_left = 0;
limit_right = 0;
get_mouse_type(&num_buttons);
return num_buttons;
cleanup: {
if (mouse_started > 0) {
delete_sem(mouse_started);
}
be_mouse_exit();
return 0;
}
}
开发者ID:AntonLanghoff,项目名称:whitecatlib,代码行数:48,代码来源:bmousapi.cpp
示例19: RemoveCommonFilter
CreateParamsPanel::~CreateParamsPanel()
{
RemoveCommonFilter(fEscapeFilter);
delete fEscapeFilter;
delete_sem(fExitSemaphore);
}
开发者ID:mmanley,项目名称:Antares,代码行数:7,代码来源:CreateParamsPanel.cpp
示例20: PRINTF
// _HandleStart
void
VideoProducer::_HandleStart(bigtime_t performance_time)
{
// Start producing frames, even if the output hasn't been connected yet.
PRINTF(1, ("_HandleStart(%Ld)\n", performance_time));
if (fRunning) {
PRINTF(-1, ("_HandleStart: Node already started\n"));
return;
}
fFrame = 0;
fFrameBase = 0;
fPerformanceTimeBase = performance_time;
fFrameSync = create_sem(0, "frame synchronization");
if (fFrameSync < B_OK)
goto err1;
fThread = spawn_thread(_frame_generator_, "frame generator",
B_NORMAL_PRIORITY, this);
if (fThread < B_OK)
goto err2;
resume_thread(fThread);
fRunning = true;
return;
err2:
delete_sem(fFrameSync);
err1:
return;
}
开发者ID:stippi,项目名称:Clockwerk,代码行数:35,代码来源:VideoProducer.cpp
注:本文中的delete_sem函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论