receiving data from a different thread

BlitzMax Forums/BlitzMax Programming/receiving data from a different thread

col(Posted 2013) [#1]
EDIT:- crossposted to here for possible better exposure for a reply.

Hi all,

I appreciate this isn't really supported but there are a few of us here who use BlitzMax for things other than it was intended.

I have a windows ( os ) thread created and running in C ( imported and called from 'Max ). I send the threadid thats created as a parameter to windows function. The intention is that windows will send data into the thread via the message system ( presumably by using PostThreadMessage but I don't know ). So now I need to receive messages from windows within this thread using the GetMessage command. I'm not receiving anything at all and the call blocks while waiting ( as is designed ).

Are there maybe some async operations or calls that I should be doing to keep things moving with 'Max own message pumping? I'm wondering if 'Max own message pump is processing the messages and they get lost somewhere/somehow ?

Cheers!


Henri(Posted 2013) [#2]
Hello Dave,

I know that you are versatile in Win32 programming and probably already know this, but here is some info on threads and messaging. Are you thinking about using event_queu to receive messages from threads ? Can you show what you have so far ?

EDIT: Just remembered that event system isn't threadsafe

-Henri


Derron(Posted 2013) [#3]
Build your own threadsave event system. You can even (for performance's sake) have multiple "event subsystems" - one for each thread. Each of them pushes "current ticks events" in a list which is then handled by the main event queue-manager.
Only thing not possible with that "easy" implementation is "fire" (immediately fire the triggers instead of just triggering them one after another).


bye
Ron


col(Posted 2013) [#4]
Thanks for the ideas but it was something hidden somewhere - no doubt my own fault :)

I re-installed my 'Max installation - its quite modified in places and now it's fixed even after putting my modifications back in. Rather strange but still I probably did change something and forgot about it.