• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ resume_thread函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: InitCheck

/*! \brief Begins executing the thread's ThreadFunction()
*/
status_t
RegistrarThread::Run()
{
	status_t err = InitCheck();
	if (err == B_OK) {
		fId = spawn_thread(&RegistrarThread::EntryFunction, fName,
			fPriority, (void*)this);
		err = fId >= 0 ? B_OK : fId;
		if (err == B_OK)	
			err = resume_thread(fId);
	}
	return err;
}
开发者ID:mmanley,项目名称:Antares,代码行数:15,代码来源:RegistrarThread.cpp


示例2: BMidiLocalProducer

MidiPortProducer::MidiPortProducer(int fd, const char *name)
	: BMidiLocalProducer(name),
	fFileDescriptor(fd), fKeepRunning(true)
	
{
	BString tmp = name;
	tmp << " reader";
	
	fReaderThread = spawn_thread(
		_ReaderThread, tmp.String(), B_URGENT_PRIORITY, this);

	resume_thread(fReaderThread);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:13,代码来源:PortDrivers.cpp


示例3: create_sem

void
BDirectWindow::_InitData()
{
	fConnectionEnable = false;
	fIsFullScreen = false;
	fInDirectConnect = false;

	fInitStatus = 0;

	status_t status = B_ERROR;
	struct direct_window_sync_data syncData;

	fLink->StartMessage(AS_DIRECT_WINDOW_GET_SYNC_DATA);
	if (fLink->FlushWithReply(status) == B_OK && status == B_OK)
		fLink->Read<direct_window_sync_data>(&syncData);

	if (status != B_OK)
		return;

#if DW_NEEDS_LOCKING
	fDirectLock = 0;
	fDirectLockCount = 0;
	fDirectLockOwner = -1;
	fDirectLockStack = NULL;
	fDirectSem = create_sem(0, "direct sem");
	if (fDirectSem > 0)
		fInitStatus |= DW_STATUS_SEM_CREATED;
#endif

	fSourceClippingArea = syncData.area;
	fDisableSem = syncData.disable_sem;
	fDisableSemAck = syncData.disable_sem_ack;

	fClonedClippingArea = clone_area("cloned direct area", (void**)&fBufferDesc,
		B_ANY_ADDRESS, B_READ_AREA, fSourceClippingArea);

	if (fClonedClippingArea > 0) {
		fInitStatus |= DW_STATUS_AREA_CLONED;

		fDirectDaemonId = spawn_thread(_daemon_thread, "direct daemon",
			B_DISPLAY_PRIORITY, this);

		if (fDirectDaemonId > 0) {
			fDaemonKiller = false;
			if (resume_thread(fDirectDaemonId) == B_OK)
				fInitStatus |= DW_STATUS_THREAD_STARTED;
			else
				kill_thread(fDirectDaemonId);
		}
	}
}
开发者ID:mmanley,项目名称:Antares,代码行数:51,代码来源:DirectWindow.cpp


示例4: ethernet_up

status_t
ethernet_up(net_device *_device)
{
	ethernet_device *device = (ethernet_device *)_device;

	device->fd = open(device->name, O_RDWR);
	if (device->fd < 0)
		return errno;

	uint64 dummy;
	if (ioctl(device->fd, ETHER_INIT, &dummy, sizeof(dummy)) < 0)
		goto err;

	if (ioctl(device->fd, ETHER_GETADDR, device->address.data, ETHER_ADDRESS_LENGTH) < 0)
		goto err;

	if (ioctl(device->fd, ETHER_GETFRAMESIZE, &device->frame_size, sizeof(uint32)) < 0) {
		// this call is obviously optional
		device->frame_size = ETHER_MAX_FRAME_SIZE;
	}

	if (update_link_state(device, false) == B_OK) {
		// device supports retrieval of the link state

		// Set the change notification semaphore; doesn't matter
		// if this is supported by the device or not
		ioctl(device->fd, ETHER_SET_LINK_STATE_SEM, &sLinkChangeSemaphore,
			sizeof(sem_id));

		MutexLocker _(&sListLock);

		if (sCheckList.IsEmpty()) {
			// start thread
			sLinkCheckerThread = spawn_kernel_thread(ethernet_link_checker,
				"ethernet link state checker", B_LOW_PRIORITY, NULL);
			if (sLinkCheckerThread >= B_OK)
				resume_thread(sLinkCheckerThread);
		}

		sCheckList.Add(device);
	}

	device->address.length = ETHER_ADDRESS_LENGTH;
	device->mtu = device->frame_size - device->header_length;
	return B_OK;

err:
	close(device->fd);
	device->fd = -1;
	return errno;
}
开发者ID:luciang,项目名称:haiku,代码行数:51,代码来源:ethernet.cpp


示例5: spawn_thread

status_t
Worker::Init()
{
	fThread = spawn_thread(&Worker::_Process, "worker", B_NORMAL_PRIORITY,
		this);
	if (fThread < 0)
		return fThread;

	status_t status = resume_thread(fThread);
	if (status == B_OK)
		atomic_add(&sWorkerCount, 1);

	return status;
}
开发者ID:carriercomm,项目名称:haiku,代码行数:14,代码来源:Worker.cpp


示例6: main

int
main(int argc, char** argv)
{
	thread_id thread = spawn_thread(&abort_thread, "abort test",
		B_NORMAL_PRIORITY, NULL);
	resume_thread(thread);

	status_t status = wait_for_thread(thread, NULL);
	fprintf(stderr, "abort thread aborted: %s\n", strerror(status));

	snooze(1000000LL);
	fprintf(stderr, "main exiting\n");
	return 0;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:14,代码来源:abort_test.cpp


示例7: AsyncThreadParams

// Async. processing of received message
void 
PrintServerApp::AsyncHandleMessage(BMessage* msg)
{
	AsyncThreadParams* data = new AsyncThreadParams(this, fDefaultPrinter, msg);

	thread_id tid = spawn_thread(async_thread, "async", B_NORMAL_PRIORITY,
		(void*)data);

	if (tid > 0) {
		resume_thread(tid);
	} else {
		delete data;
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:15,代码来源:PrintServerApp.R5.cpp


示例8: XOpenDisplay

extern "C" Display* XOpenDisplay(const char *name) {
  Display* display = new _XDisplay;
  memset(display, 0, sizeof(Display));
  main_thread = find_thread(NULL);
  thread_info info;
  get_thread_info(main_thread, &info);
  rename_thread(main_thread, "X Server"); 
  server_thread = spawn_thread(xmain, info.name, B_NORMAL_PRIORITY, 0);
  resume_thread(server_thread);
  suspend_thread(main_thread);
  init_font();
  set_display(display);
  return display;
}
开发者ID:HaikuArchives,项目名称:XBeLib,代码行数:14,代码来源:Display.cpp


示例9: Window

void TToolTipView::AllAttached()
{
	// initialize internal settings
	fTip.app_active = true;
	fTip.quit = false;
	fTip.stopped = true;

	fTip.tool_tip_view = this;
	fTip.tool_tip_window = Window();

	// start tool_tip thread
	resume_thread(fThread = spawn_thread((status_t (*)(void *)) ToolTipThread,
				"tip_thread", B_DISPLAY_PRIORITY, &fTip));
}
开发者ID:HaikuArchives,项目名称:Globe,代码行数:14,代码来源:TToolTip.cpp


示例10: Acquire

// ---------------------------------------------------------------
// StartPrintThread
//
// Sets the status of the current spool job to "processing" and
// starts the print_thread.
// ---------------------------------------------------------------
void 
Printer::StartPrintThread()
{
	Acquire();
	thread_id tid = spawn_thread(print_thread, "print", B_NORMAL_PRIORITY, (void*)fJob);
	if (tid > 0) {
		fJob->SetStatus(kProcessing);
		atomic_add(&fProcessing, 1);
		resume_thread(tid);
	} else {
		fJob->Release();
		Release();
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:20,代码来源:Printer.cpp


示例11: spawn_thread

void
ThemeInterfaceView::PopulateThemeList()
{
	int i;
	BControl *c;
	for (i = 0; ChildAt(i); i++) {
		c = dynamic_cast<BControl *>(ChildAt(i));
		if (c)
			c->SetEnabled(false);
	}
	thread_id tid = spawn_thread(_ThemeListPopulatorTh, "ThemeListPopulator", 
		B_LOW_PRIORITY, this);
	resume_thread(tid);
}
开发者ID:HaikuArchives,项目名称:HaikuThemeManager,代码行数:14,代码来源:ThemeInterfaceView.cpp


示例12: DECLHIDDEN

DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
{
    thread_id NativeThread;
    RT_ASSERT_PREEMPTIBLE();

    NativeThread = spawn_kernel_thread(rtThreadNativeMain, pThreadInt->szName, B_NORMAL_PRIORITY, pThreadInt);
    if (NativeThread >= B_OK)
    {
        resume_thread(NativeThread);
        *pNativeThread = (RTNATIVETHREAD)NativeThread;
        return VINF_SUCCESS;
    }
    return RTErrConvertFromHaikuKernReturn(NativeThread);
}
开发者ID:jeppeter,项目名称:vbox,代码行数:14,代码来源:thread2-r0drv-haiku.c


示例13: AbortThread

void
FindWindow::SpawnThread(int8 findMode)
{
	AbortThread();
	
	fThreadID = spawn_thread(FinderThread, "search_thread", B_NORMAL_PRIORITY, this);
	if (fThreadID > 0)
	{
		fThreadMode = findMode;
		resume_thread(fThreadID);
	}
	else
		fThreadID = -1;
}
开发者ID:humdingerb,项目名称:Paladin,代码行数:14,代码来源:FindWindow.cpp


示例14: create_port

void
SyslogDaemon::ReadyToRun()
{
	fPort = create_port(256, SYSLOG_PORT_NAME);
	fDaemon = spawn_thread(daemon_thread, "daemon", B_NORMAL_PRIORITY, this);

	if (fPort >= B_OK && fDaemon >= B_OK) {
		init_syslog_output(this);
		init_listener_output(this);

		resume_thread(fDaemon);
	} else
		Quit();
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:14,代码来源:SyslogDaemon.cpp


示例15: _DEVICE_MAP_ONLY

AutoMounter::AutoMounter(bool _DEVICE_MAP_ONLY(checkRemovableOnly),
	bool _DEVICE_MAP_ONLY(checkCDs), bool _DEVICE_MAP_ONLY(checkFloppies),
	bool _DEVICE_MAP_ONLY(checkOtherRemovable), bool _DEVICE_MAP_ONLY(autoMountRemovablesOnly),
	bool _DEVICE_MAP_ONLY(autoMountAll), bool _DEVICE_MAP_ONLY(autoMountAllBFS),
	bool _DEVICE_MAP_ONLY(autoMountAllHFS),
	bool initialMountAll, bool initialMountAllBFS, bool initialMountRestore,
	bool initialMountAllHFS)
	:	BLooper("DirPoller", B_LOW_PRIORITY),
		fInitialMountAll(initialMountAll),
		fInitialMountAllBFS(initialMountAllBFS),
		fInitialMountRestore(initialMountRestore),
		fInitialMountAllHFS(initialMountAllHFS),
		fSuspended(false),
		fQuitting(false)
{
#if _INCLUDES_CLASS_DEVICE_MAP
	fScanParams.shortestRescanHartbeat = 5000000;
	fScanParams.checkFloppies = checkFloppies;
	fScanParams.checkCDROMs = checkCDs;
	fScanParams.checkOtherRemovable = checkOtherRemovable;
	fScanParams.removableOrUnknownOnly = checkRemovableOnly;
	
	fAutomountParams.mountAllFS = autoMountAll;
	fAutomountParams.mountBFS = autoMountAllBFS;
	fAutomountParams.mountHFS = autoMountAllHFS;
	fAutomountParams.mountRemovableDisksOnly = autoMountRemovablesOnly;

	gSilentAutoMounter = true;
	
	if (!BootedInSafeMode()) {
		ReadSettings();
		thread_id rescan = spawn_thread(AutoMounter::InitialRescanBinder, 
			"AutomountInitialScan", B_DISPLAY_PRIORITY, this);
		resume_thread(rescan);
	} else {
		// defeat automounter in safe mode, don't even care about the settings
		fAutomountParams.mountAllFS = false;
		fAutomountParams.mountBFS = false;
		fAutomountParams.mountHFS = false;
		fInitialMountAll = false;
		fInitialMountAllBFS = false;
		fInitialMountRestore = false;
		fInitialMountAllHFS = false;
	}

	//	Watch mount/unmount
	TTracker::WatchNode(0, B_WATCH_MOUNT, this);
#endif
}
开发者ID:HaikuArchives,项目名称:OpenTracker,代码行数:49,代码来源:AutoMounter.cpp


示例16: BMessageRunner

void SnowView::AttachedToWindow()
{
	BView *p;
	rgb_color col;
	fAttached = true;
/*	if (!fMsgRunner)
		fMsgRunner = new BMessageRunner(BMessenger(this), 
					new BMessage(MSG_PULSE_ME), 
					INTERVAL);
*/
	p = Parent();
	if (p)
		col = B_TRANSPARENT_32_BIT;//Parent()->ViewColor();
	else
		col = ui_color(B_PANEL_BACKGROUND_COLOR);
	SetViewColor(col);
//	BScreen bs;
//	fCachedWsWidth = bs.Frame().IntegerWidth();
//	fCachedWsHeight = bs.Frame().IntegerHeight();
	fDragger = dynamic_cast<BDragger *>(FindView("_dragger_"));
	if (fDragger && p) {
		fCachedParent = p;
		fCachedWsWidth = p->Frame().IntegerWidth();
		fCachedWsHeight = p->Frame().IntegerHeight();
		fDragger->SetViewColor(col);
		if (fDragger->InShelf()) {
			p->SetFlags(p->Flags() | B_DRAW_ON_CHILDREN);
#ifdef B_BEOS_VERSION_DANO
			p->SetDoubleBuffering(p->DoubleBuffering() | B_UPDATE_EXPOSED);
#endif
			ResizeTo(p->Bounds().Width(), p->Bounds().Height());
			MoveTo(0,0);
			fDragger->MoveTo(p->Bounds().Width()-7, p->Bounds().Height()-7);
		}
		BRect fallenRect(p->Bounds());
		fallenRect.top = fallenRect.bottom - FALLEN_HEIGHT;
		fFallenBmp = new BBitmap(fallenRect, B_BITMAP_ACCEPTS_VIEWS, B_CMAP8);
		memset(fFallenBmp->Bits(), B_TRANSPARENT_MAGIC_CMAP8, (size_t)(fallenRect.Height()*fFallenBmp->BytesPerRow()));
		fFallenView = new BView(fallenRect, "offscreen fallen snow", B_FOLLOW_NONE, 0);
		fFallenBmp->AddChild(fFallenView);
		fFallenReg = new BRegion;
		fInvalidator = spawn_thread(SnowMakerThread, INVALIDATOR_THREAD_NAME, B_LOW_PRIORITY, (void *)this);
		resume_thread(fInvalidator);
		printf("BSnow: OK: ws = %ld x %ld\n", fCachedWsWidth, fCachedWsHeight);
#ifdef DEBUG
		Window()->AddCommonFilter(new BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, msgfilter));
#endif
	}
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:49,代码来源:SnowView.cpp


示例17: switch

void
MediaWindow::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case ML_RESTART_THREAD_FINISHED:
			fRestartThread = -1;
			_InitMedia(false);
			break;

		case ML_RESTART_MEDIA_SERVER:
		{
			fRestartThread = spawn_thread(&MediaWindow::_RestartMediaServices,
				"restart_thread", B_NORMAL_PRIORITY, this);
			if (fRestartThread < 0)
				fprintf(stderr, "couldn't create restart thread\n");
			else
				resume_thread(fRestartThread);
			break;
		}

		case B_MEDIA_WEB_CHANGED:
		case ML_SELECTED_NODE:
		{
			PRINT_OBJECT(*message);

			MediaListItem* item = static_cast<MediaListItem*>(
					fListView->ItemAt(fListView->CurrentSelection()));
			if (item == NULL)
				break;

			fCurrentNode.SetTo(NULL);
			_ClearParamView();
			item->AlterWindow(this);
			break;
		}

		case B_MEDIA_SERVER_STARTED:
		case B_MEDIA_SERVER_QUIT:
		{
			PRINT_OBJECT(*message);
			_InitMedia(false);
			break;
		}

		default:
			BWindow::MessageReceived(message);
			break;
	}
}
开发者ID:bhanug,项目名称:haiku,代码行数:49,代码来源:MediaWindow.cpp


示例18: BAutolock

status_t NNTPResponse::Read(Logger* logger)
{
	BAutolock(this);

	// set up & read the first buffer
	firstBuffer = new RespBuffer(multiline ? LargeBufferSize : MaxStatusRespSize);
	lastBuffer = firstBuffer;
	status_t result = connection->ReadBuffer(firstBuffer);
	if (result != B_NO_ERROR)
		return result;

	// log the response
	if (logger) {
		logger->Log(NextLine());
		Reset();
		}

	// get the result code and set "multiline" based on it
	// we need this before we can call IsFinalBuffer()
	result = NextIntField();
	switch (result) {
		case 100:	case 215:	case 218:	case 220:	case 221:	case 222:	case 224:
		case 230:	case 231:	case 282:	case 288:
			multiline = true;
			break;

		default:
			multiline = false;
			break;
		}

	// if that's all, we're done
	if (IsFinalBuffer(firstBuffer))
		return result;

	// otherwise, start reading the rest of the buffers
	RespBuffer* nextBuffer = new RespBuffer(LargeBufferSize);
	SpillBuffer(firstBuffer, nextBuffer);
	NNTPResponseThreadParams* threadParams = new NNTPResponseThreadParams(this, nextBuffer);
	readerThread =
		spawn_thread(ThreadStarter, "NNTPResponse reader", B_NORMAL_PRIORITY, threadParams);
	if (readerThread < 0) {
		delete threadParams;
		return readerThread;
		}
	resume_thread(readerThread);

	return result;
}
开发者ID:HaikuArchives,项目名称:Item,代码行数:49,代码来源:NNTPResponse.cpp


示例19: InitBuffers

void
TMagnify::AttachedToWindow()
{
	int32 width, height;
	fParent->PixelCount(&width, &height);
	InitBuffers(width, height, fParent->PixelSize(), fParent->ShowGrid());

	fThread = spawn_thread(TMagnify::MagnifyTask, "MagnifyTask",
		B_NORMAL_PRIORITY, this);

	resume_thread(fThread);

	SetViewColor(B_TRANSPARENT_32_BIT);
	MakeFocus();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:15,代码来源:Magnify.cpp


示例20: spawn_thread

// Run
status_t
Task::Run()
{
	const char* name = (fName.GetLength() > 0 ? fName.GetString() : "task");
#if USER
	fThread = spawn_thread(&_ThreadEntry, name, B_NORMAL_PRIORITY, this);
#else
	fThread = spawn_kernel_thread(&_ThreadEntry, name, B_NORMAL_PRIORITY, this);
#endif
	if (fThread < 0)
		return fThread;
	fDone = false;
	resume_thread(fThread);
	return B_OK;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:16,代码来源:TaskManager.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ret函数代码示例发布时间:2022-05-30
下一篇:
C++ resume函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap