Jump to content


Photo

How to make thread doing a job each 1 minute in a plugin ?


  • Please log in to reply
9 replies to this topic

#1 hyperonex

  • Senior Member
  • 82 posts

+7
Neutral

Posted 25 April 2011 - 13:13

I'm writing a worker thread within my plugin which must wakeup each 1 minute to do some thing and then performs a sleep again. I have used the sleep routine within the function handled by the thread but th whole system becomes not stable.
Is there any other way to do this ?
Thanks for your help.

Re: How to make thread doing a job each 1 minute in a plugin ? #2 PaphosAL

  • Senior Member
  • 251 posts

+2
Neutral

Posted 25 April 2011 - 17:56

From the very limited information you have given us as to what exactly it is you are trying to do every 60 seconds, my guess is that your Plugin is hogging the system while it counts down each minute...

Why not CALL your task from a script via a cron job every minute? And use your Plugin just to turn the task On or Off by touching or removing a 0 byte 'flag' file in /var/etc for example?

But more info on what you are up to will definately help here, m8...

Cheers- AL Posted Image

Re: How to make thread doing a job each 1 minute in a plugin ? #3 MiLo

  • PLi® Core member
  • 14,045 posts

+298
Excellent

Posted 25 April 2011 - 19:27

Use a timer to do this, look in the code for "eTimer" and you'll find plenty examples.
Real musicians never die - they just decompose

Re: How to make thread doing a job each 1 minute in a plugin ? #4 hyperonex

  • Senior Member
  • 82 posts

+7
Neutral

Posted 26 April 2011 - 23:33

Thank you very much I will use the timer.

Re: How to make thread doing a job each 1 minute in a plugin ? #5 hyperonex

  • Senior Member
  • 82 posts

+7
Neutral

Posted 26 April 2011 - 23:49

In this case My task should be a binary file? I try it by I get segmentation fault when i try to run my program through telnet. Please give me a makefile to compile a c program to be run on my box.

Re: How to make thread doing a job each 1 minute in a plugin ? #6 Sjaaky

  • Senior Member
  • 7,443 posts

+41
Good

Posted 27 April 2011 - 09:02

> Please give me a makefile to compile a c program to be run on my box.

Which box are you developing for? There should be plenty of examples in your development environment.

Re: How to make thread doing a job each 1 minute in a plugin ? #7 hyperonex

  • Senior Member
  • 82 posts

+7
Neutral

Posted 27 April 2011 - 09:44

my box is a dm500. I have reused the makefile for compiling plugins while changing the target to be a binary file instead of .so file but I get a segmentation fault when I try to run it on by box !!! (I have also removed the -shared link option from the makefile )
I need a makefile sample to compile my enigma1 program for a dm500 with open-pli as image.
Thanks

Re: How to make thread doing a job each 1 minute in a plugin ? #8 Sjaaky

  • Senior Member
  • 7,443 posts

+41
Good

Posted 27 April 2011 - 20:44

But how do you want to talk with enigma, if your program is not an enigma plugin?

Re: How to make thread doing a job each 1 minute in a plugin ? #9 hyperonex

  • Senior Member
  • 82 posts

+7
Neutral

Posted 28 April 2011 - 08:45

In fact, I want to start program (the binary file) from my plugin. That's why first I need to compile my program and to test it on my box. Then I need to compile my plugin where I will launch my program through "system" function call.
The issue is that I can't compile my program without getting the segmentation fault when I try to run it. Hence I need a makefile sample leading to compiling a standalone program to be run on my dm 500 with open pli image. in other words assuming that I have developed an emu such as cccam and I want to compile it before putting it under /bin directory How I will compile it ?

Re: How to make thread doing a job each 1 minute in a plugin ? #10 dAF2000

  • PLi® Ex-Leden
  • 14,151 posts

+52
Good

Posted 28 April 2011 - 14:00

In the cdk tree we build some binaries like "setupnetwork" (I thought). You could check these makefiles and sources as an example.
Many answers to your question can be found in our wiki: http://openpli.org/wiki


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users