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

C++ close_handle函数代码示例

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

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



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

示例1: ex_stop

FKERN_API f8_status ex_stop()
{
	struct kernel_t * kernel = (struct kernel_t*)&g_kernel;
	
	printf("Shutting down F8 runtime kernel...\n");

	taskFlag = TSK_STOPPING;
	
	if(kthreadId){
		stop_rthread((RTK_HANDLE)kthreadId);
		close_handle((RTK_HANDLE)kthreadId);
	}
	if(agentThreadId){
		taskFlag = TSK_STOPPING;
		stop_rthread((RTK_HANDLE)agentThreadId);
		close_handle((RTK_HANDLE)agentThreadId);
	}
	kthreadId = 0;
	agentThreadId = 0;
	printf("F8 runtime kernel stopped.\n");
	ke_lock(kernel, 0);
	ki_save_nvram(kernel);
	ke_unlock(kernel,0);

	return F8_SUCCESS;
}
开发者ID:george-kuo,项目名称:GoSysWare,代码行数:26,代码来源:main.c


示例2: debug_event_destroy

static void debug_event_destroy( struct object *obj )
{
    struct debug_event *event = (struct debug_event *)obj;
    assert( obj->ops == &debug_event_ops );

    /* If the event has been sent already, the handles are now under the */
    /* responsibility of the debugger process, so we don't touch them    */
    if (event->state == EVENT_QUEUED)
    {
        struct process *debugger = event->debugger->process;
        switch(event->data.code)
        {
        case CREATE_THREAD_DEBUG_EVENT:
            close_handle( debugger, event->data.info.create_thread.handle, NULL );
            break;
        case CREATE_PROCESS_DEBUG_EVENT:
            if (event->data.info.create_process.file)
                close_handle( debugger, event->data.info.create_process.file, NULL );
            close_handle( debugger, event->data.info.create_process.thread, NULL );
            close_handle( debugger, event->data.info.create_process.process, NULL );
            break;
        case LOAD_DLL_DEBUG_EVENT:
            if (event->data.info.load_dll.handle)
                close_handle( debugger, event->data.info.load_dll.handle, NULL );
            break;
        }
    }
    if (event->sender->context == &event->context) event->sender->context = NULL;
    release_object( event->sender );
    release_object( event->debugger );
}
开发者ID:howard5888,项目名称:wineT,代码行数:31,代码来源:debugger.c


示例3: unmake_timer_thread

extern void unmake_timer_thread(void)
{
  CONTEXT timer_thread_context;
  BOOL result;
  DIAGNOSTIC(2,"unmaking timer thread",0,0);
  suspend_thread(timer_thread);
  DIAGNOSTIC(3,"timer thread suspended",0,0);
  timer_thread_context.ContextFlags = CONTEXT_CONTROL;
  result = GetThreadContext((HANDLE)timer_thread,
			    &timer_thread_context);
  if (result == FALSE)
    error("GetThreadContext(timer) failed; GetLastError() returns %d",
	  GetLastError());
  DIAGNOSTIC(3,"timer thread context obtained",0,0);
  timer_thread_context.Eip = (DWORD)timer_thread_end;
  result = SetThreadContext((HANDLE)timer_thread,
			    &timer_thread_context);
  if (result == FALSE)
    error("SetThreadContext(timer) failed; GetLastError() returns %d",
	  GetLastError());
  DIAGNOSTIC(3,"timer thread context set",0,0);
  set_event(timer_event);
  DIAGNOSTIC(3,"timer event set",0,0);
  resume_thread(timer_thread);
  DIAGNOSTIC(3,"timer thread resumed",0,0);
  wait_for_event(timer_thread);
  DIAGNOSTIC(3,"timer thread signalled",0,0);
  close_handle(timer_thread);
  close_handle(timer_event);
  DIAGNOSTIC(2,"timer thread unmade and forgotten",0,0);
}
开发者ID:Ravenbrook,项目名称:mlworks,代码行数:31,代码来源:native_threads.c


示例4: shim_do_pipe2

int shim_do_pipe2 (int * filedes, int flags)
{
    if (!filedes)
        return -EINVAL;

    int ret = 0;

    struct shim_handle * hdl1 = get_new_handle();
    struct shim_handle * hdl2 = get_new_handle();

    if (!hdl1 || !hdl2) {
        ret = -ENOMEM;
        goto out;
    }

    hdl1->type       = TYPE_PIPE;
    set_handle_fs(hdl1, &pipe_builtin_fs);
    hdl1->flags      = O_RDONLY;
    hdl1->acc_mode   = MAY_READ;

    hdl2->type       = TYPE_PIPE;
    set_handle_fs(hdl2, &pipe_builtin_fs);
    hdl2->flags      = O_WRONLY;
    hdl2->acc_mode   = MAY_WRITE;

    if ((ret = create_pipes(&hdl1->info.pipe.pipeid,
                            &hdl1->pal_handle, &hdl2->pal_handle,
                            &hdl1->uri, flags)) < 0)
        goto out;

    qstrcopy(&hdl2->uri, &hdl2->uri);

    flags = flags & O_CLOEXEC ? FD_CLOEXEC : 0;
    int vfd1 = set_new_fd_handle(hdl1, flags, NULL);
    int vfd2 = set_new_fd_handle(hdl2, flags, NULL);

    if (vfd1 < 0 || vfd2 < 0) {
        if (vfd1 >= 0) {
            struct shim_handle * tmp = detach_fd_handle(vfd1, NULL, NULL);
            if (tmp)
                close_handle(tmp);
        }
        if (vfd2 >= 0) {
            struct shim_handle * tmp = detach_fd_handle(vfd2, NULL, NULL);
            if (tmp)
                close_handle(tmp);
        }
        goto out;
    }

    filedes[0] = vfd1;
    filedes[1] = vfd2;
out:
    if (hdl1)
        put_handle(hdl1);
    if (hdl2)
        put_handle(hdl2);
    return ret;
}
开发者ID:brianmcgillion,项目名称:graphene,代码行数:59,代码来源:shim_pipe.c


示例5: _on_add_edit_tags

static __uint _on_add_edit_tags(PCRTK_PACKET p)
{
	ONLINE_CONFIG::reload_tags_ack *ack;
	RTK_CURSOR	hNode, hTag, hGroup;
	RTK_TAG		*pTag;
	RTK_GROUP	grp;
	__bool		bEdit;
	
	__uint tagcount, i;

	ack = (ONLINE_CONFIG::reload_tags_ack *)p->data;
	tagcount = p->data_size / sizeof(*ack);
	if(p->data_size % sizeof(*ack)){
		return 0;
	}
	ZeroMemory(&grp, sizeof(grp));

	if( !lock_rtdb(__true, 100) ){
		return 0;
	}

	hNode = HNODE_LOCAL_MACHINE;
	hTag = hGroup = 0;
	host_to_node(&g_ThisNode->key, &grp.node);

	if(PACKET_TYPE(p) == PT_EditTag){
		bEdit = __true;
	}else{
		bEdit = __false;
	}

	for(i=0; i<tagcount; i++){
		hGroup = open_group(hNode, &ack[i].tag.group);
		grp.key = ack[i].tag.group;
		if(!hGroup){
			hGroup = create_group(hNode, &grp);
		}
		if(hGroup){
			hTag = create_tag(hGroup, &ack[i].tag.key, &ack[i].tag.s);
			pTag  = (RTK_TAG*)cursor_get_item(hTag);
			if(pTag){
				*pTag = ack[i].tag;
				mark_expired(pTag);
				close_handle(hTag);
				if(bEdit){
					// add-tag event is auto-fired
					fire_rtdb_event(EV_ModifyTag, pTag);
				}				
			}					
		}
		close_handle(hGroup);
	}

	unlock_rtdb();

	return tagcount;
}
开发者ID:eseawind,项目名称:CNCS_PMC-Conductor,代码行数:57,代码来源:backup.cpp


示例6: GetPrivateProfileString

/*
	determine which tags should be saved to history database.
*/
void CInMemoryBuffer::buildStreamList()
{
	RTK_CURSOR hNode;
	RTK_CURSOR hGroup;
	RTK_CURSOR hTag;
	PCRTK_TAG  pTag;
	TAG_NAME tn;
	char nodeName[rtkm_node_key_length + 1];
	
	GetPrivateProfileString(
		"PMC",
		"ServerName",
		"LocalServer",
		nodeName,
		sizeof(nodeName),
		get_config_file()
		);
	CNodeName nodeKey(nodeName);

	//utils_debug("wlock 3\n");
	WriteLock();
	
	if(!lock_rtdb(__false, 100)){
		//utils_debug("release 6\n");
		Release();
		return;
	}
	
	// clear list
	clearStreamList();
	
	hNode = open_node(nodeKey);
	if(hNode){
		hGroup = cursor_open_first_subitem(hNode);
		while(!cursor_is_end(hGroup)){
			hTag = cursor_open_first_subitem(hGroup);
			while(!cursor_is_end(hTag)){
				pTag = (PCRTK_TAG)cursor_get_item(hTag);
				if(pTag->s.Flags & TF_SaveToHistory){
					tn.node = pTag->node;
					tn.sname.group = pTag->group;
					tn.sname.tag = pTag->key;
					addTag(&tn);
				}
				cursor_move_next(hTag);
			}
			close_handle(hTag);
			cursor_move_next(hGroup);
		}
		close_handle(hGroup);
	}

	unlock_rtdb();
	
	//utils_debug("release 7\n");
	Release();
}
开发者ID:eseawind,项目名称:CNCS_PMC-Conductor,代码行数:60,代码来源:buffer.cpp


示例7: _read_tags

__uint _fastcall _read_tags(
	__uint count, 
	PCTAG_NAME names, 
	Ppmc_value_t values,
	__uint & existed
	)
{
	RTK_CURSOR	hNode, hTag;
	NODE_KEY	cachedNode;
	RTK_TAG		*pTag;
	__uint		i, valids;

	valids = 0;
	existed = 0;
	ZeroMemory(values, sizeof(values[0]) * count);
	if(!lock_rtdb(false, 1000)){
		return 0;
	}
	hNode = 0;
	hTag = 0;
	RTK_TIME now;
	rtk_time_mark(&now);
	hNode = 0;
	memset(&cachedNode, 0, sizeof(cachedNode));
	for(i=0; i<count; i++){
		if(!(cachedNode == names[i].node)){
			close_handle(hNode);
			hNode = 0;			
		}
		if(!hNode){
			hNode = open_node(&names[i].node);
			cachedNode = names[i].node;
		}
		if(!hNode){
			values[i].Flags &= ~TF_Valid;
			continue;
		}		
		hTag = open_tag(hNode, &names[i].sname);
		if(hTag){
			existed++;
			pTag = (RTK_TAG*)cursor_get_item(hTag);
			double diff;
			diff = rtk_time_diff(&now, &pTag->d.CachedTime);
			if(diff > (g_fltTagLife*2)){
				mark_expired(pTag);
			}
			values[i] = pTag->d.Value;
			valids++;
			close_handle(hTag);
		}else{
			values[i].Flags &= ~TF_Valid;
		}		
	}
	close_handle(hNode);
	unlock_rtdb();
	return valids;
}
开发者ID:eseawind,项目名称:CNCS_PMC-Conductor,代码行数:57,代码来源:rtkproxy.cpp


示例8: native_unmake_thread

extern void native_unmake_thread(struct c_state *c_state)
{
  DIAGNOSTIC(2,"unmaking native thread",0,0);
  c_state->eip = (word)native_thread_exit;
  set_event(c_state->native.event);
  DIAGNOSTIC(3,"set event on thread to unmake, waiting on thread",0,0);
  wait_for_event(c_state->native.thread);
  DIAGNOSTIC(3,"unmade thread signalled, closing handles",0,0);
  close_handle(c_state->native.thread);
  close_handle(c_state->native.event);
  DIAGNOSTIC(3,"closed handles; native thread is history",0,0);
}
开发者ID:Ravenbrook,项目名称:mlworks,代码行数:12,代码来源:native_threads.c


示例9: close_all

static void close_all(bt_push_t *push)
{
    bt_client_t *client = push->client;
    close_handle(push->port.protocol, push->server);
    while (client != NULL) {
        bt_client_t *next = client->next;
        close_handle(push->port.protocol, client->handle);
        pcsl_mem_free(client);
        client = next;
    }
    push->client = NULL;
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:12,代码来源:btPush.c


示例10: free_resources_and_exit

int free_resources_and_exit(const int return_code) {
    close_handle(in_read);
    close_handle(in_write);
    close_handle(out_read);
    close_handle(out_write);

    if (wsl_lib) {
        FreeLibrary(wsl_lib);
    }

    return return_code;
}
开发者ID:UweBeckert,项目名称:boinc,代码行数:12,代码来源:hostinfo_wsl.cpp


示例11: tftp_cleanup

/** @ingroup tftp
 * Deinitialize ("turn off") TFTP client/server.
 */
void tftp_cleanup(void)
{
  LWIP_ASSERT("Cleanup called on non-initialized TFTP", tftp_state.upcb != NULL);
  udp_remove(tftp_state.upcb);
  close_handle();
  memset(&tftp_state, 0, sizeof(tftp_state));
}
开发者ID:olsner,项目名称:lwip,代码行数:10,代码来源:tftp.c


示例12: iterate_usb

int iterate_usb(int (is_interesting)(struct usb_device *), 
	int (do_open)(struct usb_dev_handle *),
	int (do_process)(struct usb_dev_handle *),
	int (do_close)(struct usb_dev_handle *)
	)
{
	usb_find_busses();
	usb_find_devices();

	int result = 0;
	struct usb_bus *bus;
	struct usb_device *dev;
 
	for (bus = usb_busses; bus; bus = bus->next) {
		for (dev = bus->devices; dev; dev = dev->next) {
			if (is_interesting(dev)) {
				struct usb_dev_handle *handle = open_handle_for_device(dev, do_open);
				if (handle) {
					if (do_process) 
						result += do_process(handle);
					
					if (do_close)
						result += close_handle(handle, do_close);
				}
				else {
					result += 1;
				}
			}
		}
	}
	return result;
}
开发者ID:lukasmueller,项目名称:temper1,代码行数:32,代码来源:usbhelper.c


示例13: sizeof

bool redir_t::spawn_child(LPCTSTR cmdline, HANDLE h_stdout, HANDLE h_stdin, HANDLE h_stderr, LPCTSTR working_directory)
{
	PROCESS_INFORMATION pi;
	STARTUPINFO si = {0};

	si.cb = sizeof(si);
	si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
	si.wShowWindow = SW_HIDE;
	si.hStdInput = h_stdin;
	si.hStdOutput = h_stdout;
	si.hStdError = h_stderr;

	if(!::CreateProcess(nullptr, (LPTSTR)cmdline,
		nullptr, nullptr,
		TRUE,
		CREATE_NEW_CONSOLE,
		NULL,
		working_directory,
		&si, &pi))
	{
		return false;
	}

	_h_child_process = pi.hProcess;
	close_handle(pi.hThread);

	return true;
}
开发者ID:movsb,项目名称:concon,代码行数:28,代码来源:redir.cpp


示例14: send_data

static void
send_data(void)
{
  u16_t *payload;
  int ret;

  if(tftp_state.last_data != NULL) {
    pbuf_free(tftp_state.last_data);
  }
  
  tftp_state.last_data = pbuf_alloc(PBUF_TRANSPORT, TFTP_HEADER_LENGTH + TFTP_MAX_PAYLOAD_SIZE, PBUF_RAM);
  if(tftp_state.last_data == NULL) {
    return;
  }

  payload = (u16_t *) tftp_state.last_data->payload;
  payload[0] = PP_HTONS(TFTP_DATA);
  payload[1] = lwip_htons(tftp_state.blknum);

  ret = tftp_state.ctx->read(tftp_state.handle, &payload[2], TFTP_MAX_PAYLOAD_SIZE);
  if (ret < 0) {
    send_error(&tftp_state.addr, tftp_state.port, TFTP_ERROR_ACCESS_VIOLATION, "Error occured while reading the file.");
    close_handle();
    return;
  }

  pbuf_realloc(tftp_state.last_data, (u16_t)(TFTP_HEADER_LENGTH + ret));
  resend_data();
}
开发者ID:Archcady,项目名称:mbed-os,代码行数:29,代码来源:tftp_server.c


示例15: tftp_tmr

void tftp_tmr(void)
{
    tftp_state.timer++;

    if (tftp_state.handle == NULL)
        return;

    if ((tftp_state.timer - tftp_state.last_pkt) >
        (TFTP_TIMEOUT_MSECS / TFTP_TIMER_MSECS))
    {
        if (tftp_state.last_data != NULL &&
            tftp_state.retries < TFTP_MAX_RETRIES)
        {
            LWIP_DEBUGF(TFTP_DEBUG | LWIP_DBG_STATE,
                    ("tftp: timeout, retrying\n"));

            resend_data(tftp_state.upcb, tftp_state.addr,
                        tftp_state.port, &tftp_state);
            tftp_state.retries++;
        } else {
            LWIP_DEBUGF(TFTP_DEBUG | LWIP_DBG_STATE,
                    ("tftp: timeout\n"));
            close_handle(&tftp_state);
        }

    }
}
开发者ID:EmuxEvans,项目名称:lwip_contrib,代码行数:27,代码来源:tftp_server.c


示例16: free

struct fnode *fnode_set_path(struct fnode *node, const char *path) {

    int lenstr = 0;

    if (strlen(path) > PATH_MAX)
        return NULL;

    if (NULL == node)
        return NULL;

    if (NULL != node->path) {
        free(node->path);
        node->path = NULL;

        /* Also close the filehandle if it's open--otherwise it would get
           lost */
        close_handle(node);
    }

    if (NULL == path)
        return node;

    lenstr = strlen(path) + 1;
    node->path = calloc(1, sizeof(char)*lenstr);

    if (NULL == node->path)
        return NULL;

    strncpy(node->path, path, lenstr);

    return node;
}
开发者ID:wcooley,项目名称:nss_exfiles,代码行数:32,代码来源:fnode.c


示例17: exfiles_trace_msg

FILE *fnode_fopen(struct fnode *node) {

    struct stat pathstat;

    exfiles_trace_msg("Entering fnode_fopen");

    if (NULL == node || NULL == node->path)
        return NULL;

    /* handle is already open */
    if (NULL != node->handle && (-1 != fileno(node->handle))) {

        if (stat(node->path, &pathstat) != 0)
            /* stat failed */
            return NULL;

        /* If open file has as late mtime as path, then just rewind the
         * handle and return it */
        if (pathstat.st_mtime <= node->mtime) {
            rewind(node->handle);
            return node->handle;
        }

        /* Otherwise, start over */
        close_handle(node);
    }

    exfiles_open_file(node->path, &(node->handle));

    exfiles_set_close_on_exec(node->handle);

    return node->handle;
}
开发者ID:wcooley,项目名称:nss_exfiles,代码行数:33,代码来源:fnode.c


示例18: send_data

static void
send_data(const ip_addr_t *addr, u16_t port)
{
  u16_t *payload;
  int ret;

  if (tftp_state.last_data != NULL) {
    pbuf_free(tftp_state.last_data);
  }

  tftp_state.last_data = init_packet(TFTP_DATA, tftp_state.blknum, TFTP_MAX_PAYLOAD_SIZE);
  if (tftp_state.last_data == NULL) {
    return;
  }

  payload = (u16_t *) tftp_state.last_data->payload;

  ret = tftp_state.ctx->read(tftp_state.handle, &payload[2], TFTP_MAX_PAYLOAD_SIZE);
  if (ret < 0) {
    send_error(addr, port, TFTP_ERROR_ACCESS_VIOLATION, "Error occured while reading the file.");
    close_handle();
    return;
  }

  pbuf_realloc(tftp_state.last_data, (u16_t)(TFTP_HEADER_LENGTH + ret));
  resend_data(addr, port);
}
开发者ID:olsner,项目名称:lwip,代码行数:27,代码来源:tftp.c


示例19: uninit_rtdb

RTDB_API void PMC_API uninit_rtdb(void)
{
	lock_rtdb(__true, INFINITE);
	RTK_CURSOR hNode;	
	
	close_handle(g_hLocalNode);
	g_hLocalNode = 0;
	
	hNode = open_first_node();
	while( !cursor_is_end(hNode) ){
		cursor_delete(hNode);
		hNode = open_first_node();
	}
	close_handle(hNode);
	unlock_rtdb();
}
开发者ID:george-kuo,项目名称:GoSysWare,代码行数:16,代码来源:librtdb.cpp


示例20: _on_drop_groups

__uint PMC_API _on_drop_groups(PCRTK_PACKET packet)
{
	__uint count, i, ret=0;
	RTK_CURSOR hNode, hGroup;
	PGROUP_KEY pgk;
	TAG_NAME name;
	NODE_KEY nk;

	count = packet->data_size / sizeof(GROUP_KEY);
	if(packet->data_size % sizeof(GROUP_KEY)){
		return 0;
	}
	if( !lock_rtdb(true, 100) ){
		return 0;
	}
	host_to_node(&packet->src.host, &nk);
	name.node = nk;
	hNode = open_node(&nk);
	if(hNode){
		for(i=0, pgk=(PGROUP_KEY)packet->data; i<count; i++, pgk++){
			name.sname.group = *pgk;
			hGroup = open_group(hNode, pgk);
			if(hGroup){
				cursor_delete(hGroup);
				rtk_queue_event(PT_DropGroup, &name, &packet->src);
				ret++;
			}
		}
		close_handle(hNode);
	}
	unlock_rtdb();
	return ret;
}
开发者ID:eseawind,项目名称:CNCS_PMC-Conductor,代码行数:33,代码来源:rtkproxy.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ close_log函数代码示例发布时间:2022-05-30
下一篇:
C++ close_fp函数代码示例发布时间: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