How to run functions in the background?

O

Ognjen Bezanov

Hello


I need to find a way to 'fork' a function into the background yet still
be able to send commands to it.

I am writing a media player, and I have a function which plays the
media. I want to be able to run this function but to (at the same time)
be able to send commands from it (e.g. pause, play etc...)

How could I do this?

any help appreciated.
 
W

Will McGugan

Ognjen said:
Hello


I need to find a way to 'fork' a function into the background yet still
be able to send commands to it.

I am writing a media player, and I have a function which plays the
media. I want to be able to run this function but to (at the same time)
be able to send commands from it (e.g. pause, play etc...)

How could I do this?

Put your function in a thread, and add a queue to send your commands.
Look up 'thread' and 'queue' in the help.


Will McGugan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,240
Messages
2,571,211
Members
47,845
Latest member
vojosay

Latest Threads

Top