資源簡介
基于IntervalZero RTX 環境下的進程間通訊 ,通過共享內存和內核對象進行數據通訊。

代碼片段和文件信息
//////////////////////////////////////////////////////////////////
//
//?MEMORY.c?-?C?file
//
//?This?file?was?generated?using?the?RTX?7.0.0?Application?Wizard.?
//???
//////////////////////////////////////////////////////////////////
????
#include??“memory.h“
HANDLE??hEvent1;
mmdata?*rp?=?NULL;
PVOID??p=NULL;
void?
_cdecl
main(
???????int??argc
???????char?**argv
???????char?**envp
????)
{
????//?for?periodic?timer?code
????LARGE_INTEGER??liPeriod;???//?timer?period
????HANDLE?????????hTimerhRTXThread;?????//?timer?handle
????//?for?event?server?thread?code
????HANDLE??hThread_high;?????????//?handle?for?child?thread
????DWORD???dwSuspendCount;???????//?suspend?count
int?i;
????//??RTX?periodic?timer?code:
????//??TO?DO:?Set?default?timer?period?to?your?desired?time.
????//?????????The?period?needs?to?be?an?even?multiple?of?the?HAL
????//?????????period?found?in?the?control?panel.
????//?????????This?example?uses?a?period?of?500?micro?seconds.
// mmdata?*rp?=?NULL;
// hRTXThread=RtOpenSharedMemory(SHM_MAP_WRITE|SHM_MAP_READNULL“sharemem“&p);
hRTXThread=RtOpenSharedMemory(SHM_MAP_WRITENULL“sharedmemory“&p);
if(hRTXThread==NULL)
{
printf(“error\n“);
return;
}
????hEvent1?=?RtCreateEvent(
????????????????????????????NULL?????????//?security?attribute
????????????????????????????TRUE?????????//?manual?reset
????????????????????????????FALSE????????//?initial?state
????????????????????????????“TestEvent1“?//?the?event?name
????????????????????????????);
hEvent=RtOpenEvent(NULLNULL“TestEvent“);
// ?hEvent=RtOpenSemaphore(?SYNCHRONIZE?FALSE?“TestEvent“);
// hEvent?=?RtCreateEvent(?NULL?????????//?security?attribute
??//??????????????????????????TRUE?????????//?manual?reset
????//????????????????????????FALSE????????//?initial?state
??????//??????????????????????“TestEvent“??//?the?event?name
????????//????????????????????);
?
??//?Event?code:?create?a?child?thread?high
????hThread_high?=?RtCreateThread(0
??????????????????????????????????0
??????????????????????????????????ChildThread_high
??????????????????????????????????NULL
??????????????????????????????????CREATE_SUSPENDED
??????????????????????????????????0
?????????????????????????????????);
????if?(hThread_high?==?NULL)
????{
????????//?RtWprintf(L“RtCreateThread?error?=?%d\n“GetLastError());
????????//?TO?DO:??your?exception?code?here
????????//?ExitProcess(1);
????}
????//?Event?code;?set?the?priority?of?the?child?thread?high
????if?(RtSetThreadPriority(hThread_high
????????????????????????????HIGHPRIORITY)?==?FALSE)
????{
????????//?RtWprintf(L“RtSetThreadPriority?error?=?%d\n“GetLastError());
????????//?TO?DO:??your?exception?code?here
????????//?ExitProcess(1);
????}
????//?Event?code:?resume?the?child?thread?high
????dwSuspendCount?=?RtResumeThread(hThread_high);
????if?(dwSuspendCount?==?0xFFFFFFFF)
????{
????????//?RtWprintf(L“RtResum
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4054??2007-12-06?14:48??memory\memory.c
?????文件???????8357??2007-03-26?16:10??memory\memory.dsp
?????文件????????728??2007-03-26?16:16??memory\memory.dsw
?????文件????????918??2007-07-26?15:29??memory\memory.h
?????文件??????66560??2008-01-17?19:20??memory\memory.ncb
?????文件??????58880??2008-01-17?19:20??memory\memory.opt
?????文件???????1144??2009-09-17?17:39??memory\memory.plg
?????文件????????491??2007-03-26?16:44??memory\memoryFuncs.c
?????文件??????40960??2008-12-18?11:05??show\Memory.rtss
?????文件???????3543??2007-03-26?16:04??show\ReadMe.txt
?????文件???????1078??2007-03-26?16:04??show\res\show.ico
?????文件????????396??2007-03-26?16:04??show\res\show.rc2
?????文件????????636??2007-07-26?15:29??show\resource.h
?????文件??????34896??2007-07-26?15:29??show\show.aps
?????文件????????846??2009-09-17?17:40??show\show.clw
?????文件???????1829??2007-03-26?16:04??show\show.cpp
?????文件???????4165??2007-03-26?16:08??show\show.dsp
?????文件????????730??2007-03-27?09:13??show\show.dsw
?????文件???????1302??2007-03-26?16:04??show\show.h
?????文件??????74752??2009-09-17?17:40??show\show.ncb
?????文件??????62976??2009-09-17?17:40??show\show.opt
?????文件???????1087??2008-12-18?11:06??show\show.plg
?????文件???????4664??2007-07-26?15:29??show\show.rc
?????文件???????5492??2008-12-18?11:05??show\showDlg.cpp
?????文件???????1376??2007-07-26?15:38??show\showDlg.h
?????文件????????206??2007-03-26?16:04??show\StdAfx.cpp
?????文件????????999??2007-03-26?16:04??show\StdAfx.h
?????目錄??????????0??2007-03-26?16:04??show\res
?????目錄??????????0??2009-09-17?17:40??memory
?????目錄??????????0??2009-09-17?17:40??show
............此處省略3個文件信息
評論
共有 條評論