Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is this possible?
#1
I want to have a program start up another (or 2 programs) in different threads so that I have them all running at the same time. The thing is they have to be able to communicate with each other. My idea is to make a stack in the main program and pass a pointer to each one through the $COMMAND variable. The idea is simple, but from tests that I have done it seems like FreeBasic is too strongly typed. I pass the pointer(s) as strings in command. Then I comvert the $command string to a long and then try to assign a Stack pointer to that. Freebasic won't let me do that. Some of the tests that I did gave me an implicit convertion warning and problems when I tried to push and pop and some just wouldn't compile. Is there a way to do this or am I screwed here? If it's not possible I have a request for a feature. Maybe have a command line that allows the compiler to be weakly typed.
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Reply
#2
dim foo as sometype ptr
foo=cast(sometype ptr, bar)
bar can be anything
/post]
Reply
#3
That seems too simple. Thanks, how come I never knew about the cast command I wonder. Hmm.
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Reply
#4
Threads or processes? Threads share the global data space so you make any data that needs to be shared global and then use mutex/semaphore locks to control access to it between the threads.

If you are using separate processes then you can either pass arguments via $command or you could set up some form of IPC (Inter process communication) such as a pipe, socket or shared memory map.
esus saves.... Passes to Moses, shoots, he scores!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)