Windows xp下c中的简单示例编码 [英] Simple Example Coding in c Under Windows xp

查看:78
本文介绍了Windows xp下c中的简单示例编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用CreateEvent()进行简单的编码,该编码必须说明C中的事件概念.

您能帮我个忙吗?.

I need a simple coding using CreateEvent(), that has to explain about the Event concept in C.

Can you please help me..

推荐答案

不幸的是,它不是那么简单.您可以在此处开始 [
Unfortunately it is not that simple; you can start here[^], and then go on to the associated functions. A Google search may yield some samples.


一种事件,用于在多个线程之间进行同步(有一些不同的方法).基本上,您的想法是可以创建一个事件,该事件将用于在两个独立线程(或多个独立线程)之间发出某种状态的信号,并允许您同步线程.假设一个线程需要知道另一线程何时完成某些特殊任务,在这种情况下,一个线程将仅等待另一个线程发出事件信号.

事件涉及几种方法(还有其他变体,这些是基础知识):
CreateEvent()-创建事件的句柄.
SetEvent()-设置事件,将保持信号状态直到重置.
WaitForSingleObject() -等待事件发生,默认情况下将事件设置回无信号状态.
An event in a way to synchronize between multiple threads (there''s a few different methods). Basically the idea is that you can create an event that will be used to signal some sort of state between two independent threads (or more), and this allow you to synchronize the threads. Let''s say one thread NEEDS to know when another thread finished doing some special tasking, in that case, one thread would simply wait for the other thread to signal the event.

There''s several methods involved in events (there''s other variants, these are the basics):
CreateEvent() - Creates the handle to the event.
SetEvent() - Sets the event, will remain in signaled state until reset.
WaitForSingleObject() - Waits for event to occur, sets event back to unsignaled state by default.


这篇关于Windows xp下c中的简单示例编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆