Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SharedMemory, exe trigger?
#1
Is it possible to create a SharedMemory trigger that also works both in QM and in exe?
I do not know how to approach this if it is possible.

The way I would try to approach this, is by using 'rep' and then repeatedly execute:


Code:
Select All      Help
__SharedMemory sm2
lpstr m=sm2.Open("...

But I assume this is not the most effective (system resource friendly) way.


Related topics:
http://www.quickmacros.com/forum/showthr...p?tid=5686
http://www.quickmacros.com/forum/showthr...p?tid=5128
#2
Open() is slow, but once opened, reading a byte or int from shared memory is as fast as reading any variable.

process 2:
__SharedMemory sm2
lpstr m=sm2.Open("...
rep
,if(m[0]=1) m[0]=0; out "trigger"
,0.05

process 1:
__SharedMemory sm2
lpstr m=sm2.Create("...
...
m[0]=1
#3
To avoid rep, use event.

Function sm_process1
Code:
Select All      Help
;/exe
__SharedMemory sm2
byte* m=sm2.Create("sm_82569" 1000)
__Handle ev1=CreateEvent(0 0 0 "ev1_82569")
__Handle ev2=CreateEvent(0 0 0 "ev2_82569")
int* p=m
for _i 0 10
,1
,p[0]=_i
,SetEvent ev1
SetEvent ev2
out "sm_process1 ended"

;BEGIN PROJECT
;main_function  sm_process1
;exe_file  $my qm$\sm_process1.qmm
;flags  6
;guid  {5EF00E1E-5835-41AF-86CA-1777B56049EC}
;END PROJECT

Function sm_process2
Code:
Select All      Help
;/exe
__SharedMemory sm2
byte* m=sm2.Create("sm_82569" 1000)
__Handle ev1=CreateEvent(0 0 0 "ev1_82569")
__Handle ev2=CreateEvent(0 0 0 "ev2_82569")
rep
,sel wait(0 HM ev1 ev2)
,,case 1
,,int* p=m
,,out p[0]
,,
,,case 2
,,break
out "sm_process2 ended"

;BEGIN PROJECT
;main_function  sm_process2
;exe_file  $my qm$\sm_process2.qmm
;flags  6
;guid  {473089D6-9493-4D5D-8351-736A645793E4}
;END PROJECT

To test, run sm_process2 first, then sm_process1.
#4
Thank you!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)