Hi, I would like to collect some data in my module which would listen to the event socket and then a scheduler would kick off every so often to clean up the data. Does anyone know what is the best way to implement a scheduler in a mod? Best Regards, Mark
On Sun, Aug 9, 2009 at 11:57 AM, mark morreny <markmorreny@gmail.com> wrote:
Hi,
I would like to collect some data in my module which would listen to the event socket and then a scheduler would kick off every so often to clean up the data.
Does anyone know what is the best way to implement a scheduler in a mod?
Best Regards, Mark
Just use the API that the FreeSWITCH core already has for you. Check src/include/switch_scheduler.h for details, the comments in there should be enough for you to learn to use it. If not, you can ask here more specific questions. -- Moises Silva Software Developer Sangoma Technologies Inc. | 50 McIntosh Drive, Suite 120, Markham ON L3R 9T3 Canada t. 1 905 474 1990 x 128 | e. moy@sangoma.com
Hi, Thank you for pointing out sched_api. What about if I want to do a recurring schedule. is it possible or I should just call sched_api another time in the execution of my clean up code. Thanks, Mark ---------- Forwarded message ---------- From: Moises Silva <moises.silva@gmail.com> Date: Mon, Aug 10, 2009 at 12:05 AM Subject: Re: [Freeswitch-users] Scheduler in module To: freeswitch-users@lists.freeswitch.org On Sun, Aug 9, 2009 at 11:57 AM, mark morreny <markmorreny@gmail.com> wrote:
Hi,
I would like to collect some data in my module which would listen to the event socket and then a scheduler would kick off every so often to clean up the data.
Does anyone know what is the best way to implement a scheduler in a mod?
Best Regards, Mark
Just use the API that the FreeSWITCH core already has for you. Check src/include/switch_scheduler.h for details, the comments in there should be enough for you to learn to use it. If not, you can ask here more specific questions. -- Moises Silva Software Developer Sangoma Technologies Inc. | 50 McIntosh Drive, Suite 120, Markham ON L3R 9T3 Canada t. 1 905 474 1990 x 128 | e. moy@sangoma.com _______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Re schedule is done in your callback, take a look at places that use these apis in the code for details. On Aug 10, 2009, at 6:58 AM, mark morreny <markmorreny@gmail.com> wrote:
Hi,
Thank you for pointing out sched_api.
What about if I want to do a recurring schedule. is it possible or I should just call sched_api another time in the execution of my clean up code.
Thanks, Mark
---------- Forwarded message ---------- From: Moises Silva <moises.silva@gmail.com> Date: Mon, Aug 10, 2009 at 12:05 AM Subject: Re: [Freeswitch-users] Scheduler in module To: freeswitch-users@lists.freeswitch.org
On Sun, Aug 9, 2009 at 11:57 AM, mark morreny <markmorreny@gmail.com> wrote: Hi,
I would like to collect some data in my module which would listen to the event socket and then a scheduler would kick off every so often to clean up the data.
Does anyone know what is the best way to implement a scheduler in a mod?
Best Regards, Mark
Just use the API that the FreeSWITCH core already has for you. Check src/include/switch_scheduler.h for details, the comments in there should be enough for you to learn to use it. If not, you can ask here more specific questions.
-- Moises Silva Software Developer Sangoma Technologies Inc. | 50 McIntosh Drive, Suite 120, Markham ON L3R 9T3 Canada t. 1 905 474 1990 x 128 | e. moy@sangoma.com
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi, In my LOAD_FUNCTION, I am trying to have freeswitch to flush out some data every 10 s. The following lines of code does not show any effect at all. switch_scheduler_task_thread_start(); switch_scheduler_add_task(switch_epoch_time_now(NULL), data_flush_callback, "data_flush","core",0,NULL,SSHF_NONE|SSHF_NO_DEL); SWITCH_STANDARD_SCHED_FUNC(data_flush_callback) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "starting to flush data buffer...\n"); task->runtime = switch_time_now() + 10; } Does anyone know how to get it to work? Thanks, Mark ---------- Forwarded message ---------- From: Brian West <brian@freeswitch.org> Date: Mon, Aug 10, 2009 at 8:53 PM Subject: Re: [Freeswitch-users] Fwd: Scheduler in module To: freeswitch-users@lists.freeswitch.org switch_rtp.c has a simple one for the zrtp cache storing. /b On Aug 10, 2009, at 7:13 AM, Michael Jerris wrote:
Re schedule is done in your callback, take a look at places that use these apis in the code for details.
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi, I did the same thing on my side.... API CALL [load(mod_skel)] output: +OK 2009-08-12 11:08:18.37891 [DEBUG] switch_scheduler.c:214 Added task 2 data_flush (core) to run at 1250089698 2009-08-12 11:08:18.37891 [CONSOLE] switch_loadable_module.c:889 Successfully Loaded [mod_skel] 2009-08-12 11:08:18.37891 [NOTICE] switch_loadable_module.c:270 Adding API Function 'skel' freeswitch@Maths-Mac.local> 2009-08-12 11:08:18.207113 [ERR] mod_skel.c:120 starting to flush data buffer... Note that you don't need to start the thread manually, the core already has threads running for the scheduler. Mathieu Rene Avant-Garde Solutions Inc Office: + 1 (514) 664-1044 x100 Cell: +1 (514) 664-1044 x200 mrene@avgs.ca On 12-Aug-09, at 7:26 AM, mark morreny wrote:
Hi,
In my LOAD_FUNCTION, I am trying to have freeswitch to flush out some data every 10 s. The following lines of code does not show any effect at all.
switch_scheduler_task_thread_start(); switch_scheduler_add_task(switch_epoch_time_now(NULL), data_flush_callback, "data_flush","core",0,NULL,SSHF_NONE| SSHF_NO_DEL);
SWITCH_STANDARD_SCHED_FUNC(data_flush_callback) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "starting to flush data buffer...\n");
task->runtime = switch_time_now() + 10;
}
Does anyone know how to get it to work?
Thanks, Mark
---------- Forwarded message ---------- From: Brian West <brian@freeswitch.org> Date: Mon, Aug 10, 2009 at 8:53 PM Subject: Re: [Freeswitch-users] Fwd: Scheduler in module To: freeswitch-users@lists.freeswitch.org
switch_rtp.c has a simple one for the zrtp cache storing.
/b
On Aug 10, 2009, at 7:13 AM, Michael Jerris wrote:
Re schedule is done in your callback, take a look at places that use these apis in the code for details.
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi, Thank you for your help. I get that too, but the callback does not execute the second time. When I do task->runtime = switch_time_now() + 10;, what does +10 mean? Does it mean 10 s or 10 mins? Thanks, Mark On Wed, Aug 12, 2009 at 11:09 PM, Mathieu Rene <mrene_lists@avgs.ca> wrote:
Hi, I did the same thing on my side.... API CALL [load(mod_skel)] output: +OK
2009-08-12 11:08:18.37891 [DEBUG] switch_scheduler.c:214 Added task 2 data_flush (core) to run at 1250089698 2009-08-12 11:08:18.37891 [CONSOLE] switch_loadable_module.c:889 Successfully Loaded [mod_skel] 2009-08-12 11:08:18.37891 [NOTICE] switch_loadable_module.c:270 Adding API Function 'skel' freeswitch@Maths-Mac.local> 2009-08-12 11:08:18.207113 [ERR] mod_skel.c:120 starting to flush data buffer...
Note that you don't need to start the thread manually, the core already has threads running for the scheduler.
Mathieu Rene Avant-Garde Solutions Inc Office: + 1 (514) 664-1044 x100 Cell: +1 (514) 664-1044 x200 mrene@avgs.ca
On 12-Aug-09, at 7:26 AM, mark morreny wrote:
Hi,
In my LOAD_FUNCTION, I am trying to have freeswitch to flush out some data every 10 s. The following lines of code does not show any effect at all.
switch_scheduler_task_thread_start(); switch_scheduler_add_task(switch_epoch_time_now(NULL), data_flush_callback, "data_flush","core",0,NULL,SSHF_NONE|SSHF_NO_DEL);
SWITCH_STANDARD_SCHED_FUNC(data_flush_callback) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "starting to flush data buffer...\n");
task->runtime = switch_time_now() + 10;
}
Does anyone know how to get it to work?
Thanks, Mark
---------- Forwarded message ---------- From: Brian West <brian@freeswitch.org> Date: Mon, Aug 10, 2009 at 8:53 PM Subject: Re: [Freeswitch-users] Fwd: Scheduler in module To: freeswitch-users@lists.freeswitch.org
switch_rtp.c has a simple one for the zrtp cache storing.
/b
On Aug 10, 2009, at 7:13 AM, Michael Jerris wrote:
Re schedule is done in your callback, take a look at places that use these apis in the code for details.
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
thats in seconds. Mike On Aug 14, 2009, at 8:32 AM, mark morreny wrote:
Hi,
Thank you for your help.
I get that too, but the callback does not execute the second time.
When I do task->runtime = switch_time_now() + 10;, what does +10 mean? Does it mean 10 s or 10 mins?
Thanks, Mark
On Wed, Aug 12, 2009 at 11:09 PM, Mathieu Rene <mrene_lists@avgs.ca> wrote: Hi,
I did the same thing on my side....
API CALL [load(mod_skel)] output: +OK
2009-08-12 11:08:18.37891 [DEBUG] switch_scheduler.c:214 Added task 2 data_flush (core) to run at 1250089698 2009-08-12 11:08:18.37891 [CONSOLE] switch_loadable_module.c:889 Successfully Loaded [mod_skel] 2009-08-12 11:08:18.37891 [NOTICE] switch_loadable_module.c:270 Adding API Function 'skel' freeswitch@Maths-Mac.local> 2009-08-12 11:08:18.207113 [ERR] mod_skel.c:120 starting to flush data buffer...
Note that you don't need to start the thread manually, the core already has threads running for the scheduler.
Mathieu Rene Avant-Garde Solutions Inc Office: + 1 (514) 664-1044 x100 Cell: +1 (514) 664-1044 x200 mrene@avgs.ca
On 12-Aug-09, at 7:26 AM, mark morreny wrote:
Hi,
In my LOAD_FUNCTION, I am trying to have freeswitch to flush out some data every 10 s. The following lines of code does not show any effect at all.
switch_scheduler_task_thread_start(); switch_scheduler_add_task(switch_epoch_time_now(NULL), data_flush_callback, "data_flush","core",0,NULL,SSHF_NONE| SSHF_NO_DEL);
SWITCH_STANDARD_SCHED_FUNC(data_flush_callback) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "starting to flush data buffer...\n");
task->runtime = switch_time_now() + 10;
}
Does anyone know how to get it to work?
Thanks, Mark
---------- Forwarded message ---------- From: Brian West <brian@freeswitch.org> Date: Mon, Aug 10, 2009 at 8:53 PM Subject: Re: [Freeswitch-users] Fwd: Scheduler in module To: freeswitch-users@lists.freeswitch.org
switch_rtp.c has a simple one for the zrtp cache storing.
/b
On Aug 10, 2009, at 7:13 AM, Michael Jerris wrote:
Re schedule is done in your callback, take a look at places that use these apis in the code for details.
Hi Michael, The following code was executed once, but not after the next 10 s. SWITCH_STANDARD_SCHED_FUNC(data_flush_callback) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "starting to flush data buffer...\n"); task->runtime = switch_time_now() + 10; } Any suggestion why? Thanks, Mark On Sat, Aug 15, 2009 at 2:13 AM, Michael Jerris <mike@jerris.com> wrote:
thats in seconds. Mike
On Aug 14, 2009, at 8:32 AM, mark morreny wrote:
Hi,
Thank you for your help.
I get that too, but the callback does not execute the second time.
When I do task->runtime = switch_time_now() + 10;, what does +10 mean? Does it mean 10 s or 10 mins?
Thanks, Mark
On Wed, Aug 12, 2009 at 11:09 PM, Mathieu Rene <mrene_lists@avgs.ca>wrote:
Hi, I did the same thing on my side.... API CALL [load(mod_skel)] output: +OK
2009-08-12 11:08:18.37891 [DEBUG] switch_scheduler.c:214 Added task 2 data_flush (core) to run at 1250089698 2009-08-12 11:08:18.37891 [CONSOLE] switch_loadable_module.c:889 Successfully Loaded [mod_skel] 2009-08-12 11:08:18.37891 [NOTICE] switch_loadable_module.c:270 Adding API Function 'skel' freeswitch@Maths-Mac.local> 2009-08-12 11:08:18.207113 [ERR] mod_skel.c:120 starting to flush data buffer...
Note that you don't need to start the thread manually, the core already has threads running for the scheduler.
Mathieu Rene Avant-Garde Solutions Inc Office: + 1 (514) 664-1044 x100 Cell: +1 (514) 664-1044 x200 mrene@avgs.ca
On 12-Aug-09, at 7:26 AM, mark morreny wrote:
Hi,
In my LOAD_FUNCTION, I am trying to have freeswitch to flush out some data every 10 s. The following lines of code does not show any effect at all.
switch_scheduler_task_thread_start(); switch_scheduler_add_task(switch_epoch_time_now(NULL), data_flush_callback, "data_flush","core",0,NULL,SSHF_NONE|SSHF_NO_DEL);
SWITCH_STANDARD_SCHED_FUNC(data_flush_callback) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "starting to flush data buffer...\n");
task->runtime = switch_time_now() + 10;
}
Does anyone know how to get it to work?
Thanks, Mark
---------- Forwarded message ---------- From: Brian West <brian@freeswitch.org> Date: Mon, Aug 10, 2009 at 8:53 PM Subject: Re: [Freeswitch-users] Fwd: Scheduler in module To: freeswitch-users@lists.freeswitch.org
switch_rtp.c has a simple one for the zrtp cache storing.
/b
On Aug 10, 2009, at 7:13 AM, Michael Jerris wrote:
Re schedule is done in your callback, take a look at places that use these apis in the code for details.
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
task->runtime = switch_epoch_time_now(NULL) + 10; On Aug 14, 2009, at 10:19 PM, mark morreny wrote:
Hi Michael,
The following code was executed once, but not after the next 10 s.
SWITCH_STANDARD_SCHED_FUNC(data_flush_callback) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "starting to flush data buffer...\n");
task->runtime = switch_time_now() + 10; }
Any suggestion why?
Thanks, Mark On Sat, Aug 15, 2009 at 2:13 AM, Michael Jerris <mike@jerris.com> wrote: thats in seconds.
Mike
On Aug 14, 2009, at 8:32 AM, mark morreny wrote:
Hi,
Thank you for your help.
I get that too, but the callback does not execute the second time.
When I do task->runtime = switch_time_now() + 10;, what does +10 mean? Does it mean 10 s or 10 mins?
Thanks, Mark
On Wed, Aug 12, 2009 at 11:09 PM, Mathieu Rene <mrene_lists@avgs.ca> wrote: Hi,
I did the same thing on my side....
API CALL [load(mod_skel)] output: +OK
2009-08-12 11:08:18.37891 [DEBUG] switch_scheduler.c:214 Added task 2 data_flush (core) to run at 1250089698 2009-08-12 11:08:18.37891 [CONSOLE] switch_loadable_module.c:889 Successfully Loaded [mod_skel] 2009-08-12 11:08:18.37891 [NOTICE] switch_loadable_module.c:270 Adding API Function 'skel' freeswitch@Maths-Mac.local> 2009-08-12 11:08:18.207113 [ERR] mod_skel.c:120 starting to flush data buffer...
Note that you don't need to start the thread manually, the core already has threads running for the scheduler.
Mathieu Rene Avant-Garde Solutions Inc Office: + 1 (514) 664-1044 x100 Cell: +1 (514) 664-1044 x200 mrene@avgs.ca
On 12-Aug-09, at 7:26 AM, mark morreny wrote:
Hi,
In my LOAD_FUNCTION, I am trying to have freeswitch to flush out some data every 10 s. The following lines of code does not show any effect at all.
switch_scheduler_task_thread_start(); switch_scheduler_add_task(switch_epoch_time_now(NULL), data_flush_callback, "data_flush","core",0,NULL,SSHF_NONE| SSHF_NO_DEL);
SWITCH_STANDARD_SCHED_FUNC(data_flush_callback) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "starting to flush data buffer...\n");
task->runtime = switch_time_now() + 10;
}
Does anyone know how to get it to work?
Thanks, Mark
---------- Forwarded message ---------- From: Brian West <brian@freeswitch.org> Date: Mon, Aug 10, 2009 at 8:53 PM Subject: Re: [Freeswitch-users] Fwd: Scheduler in module To: freeswitch-users@lists.freeswitch.org
switch_rtp.c has a simple one for the zrtp cache storing.
/b
On Aug 10, 2009, at 7:13 AM, Michael Jerris wrote:
Re schedule is done in your callback, take a look at places that use these apis in the code for details.
Because switch_time_now() is in microseconds. Mathieu Rene Avant-Garde Solutions Inc Office: + 1 (514) 664-1044 x100 Cell: +1 (514) 664-1044 x200 mrene@avgs.ca On 14-Aug-09, at 11:16 PM, Michael Jerris wrote:
task->runtime = switch_epoch_time_now(NULL) + 10;
On Aug 14, 2009, at 10:19 PM, mark morreny wrote:
Hi Michael,
The following code was executed once, but not after the next 10 s.
SWITCH_STANDARD_SCHED_FUNC(data_flush_callback) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "starting to flush data buffer...\n");
task->runtime = switch_time_now() + 10; }
Any suggestion why?
Thanks, Mark On Sat, Aug 15, 2009 at 2:13 AM, Michael Jerris <mike@jerris.com> wrote: thats in seconds.
Mike
On Aug 14, 2009, at 8:32 AM, mark morreny wrote:
Hi,
Thank you for your help.
I get that too, but the callback does not execute the second time.
When I do task->runtime = switch_time_now() + 10;, what does +10 mean? Does it mean 10 s or 10 mins?
Thanks, Mark
On Wed, Aug 12, 2009 at 11:09 PM, Mathieu Rene <mrene_lists@avgs.ca> wrote: Hi,
I did the same thing on my side....
API CALL [load(mod_skel)] output: +OK
2009-08-12 11:08:18.37891 [DEBUG] switch_scheduler.c:214 Added task 2 data_flush (core) to run at 1250089698 2009-08-12 11:08:18.37891 [CONSOLE] switch_loadable_module.c:889 Successfully Loaded [mod_skel] 2009-08-12 11:08:18.37891 [NOTICE] switch_loadable_module.c:270 Adding API Function 'skel' freeswitch@Maths-Mac.local> 2009-08-12 11:08:18.207113 [ERR] mod_skel.c:120 starting to flush data buffer...
Note that you don't need to start the thread manually, the core already has threads running for the scheduler.
Mathieu Rene Avant-Garde Solutions Inc Office: + 1 (514) 664-1044 x100 Cell: +1 (514) 664-1044 x200 mrene@avgs.ca
On 12-Aug-09, at 7:26 AM, mark morreny wrote:
Hi,
In my LOAD_FUNCTION, I am trying to have freeswitch to flush out some data every 10 s. The following lines of code does not show any effect at all.
switch_scheduler_task_thread_start(); switch_scheduler_add_task(switch_epoch_time_now(NULL), data_flush_callback, "data_flush","core",0,NULL,SSHF_NONE| SSHF_NO_DEL);
SWITCH_STANDARD_SCHED_FUNC(data_flush_callback) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "starting to flush data buffer...\n");
task->runtime = switch_time_now() + 10;
}
Does anyone know how to get it to work?
Thanks, Mark
---------- Forwarded message ---------- From: Brian West <brian@freeswitch.org> Date: Mon, Aug 10, 2009 at 8:53 PM Subject: Re: [Freeswitch-users] Fwd: Scheduler in module To: freeswitch-users@lists.freeswitch.org
switch_rtp.c has a simple one for the zrtp cache storing.
/b
On Aug 10, 2009, at 7:13 AM, Michael Jerris wrote:
Re schedule is done in your callback, take a look at places that use these apis in the code for details.
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi, Thank you very much. I am able to get my sched api to work now. I still have one problem. I am getting core dump if freeswitch is shut down by typing in "shutdown" in the CLI. How can I control the shutdown process so that it will wait until all the existing sched jobs are done before starting to free the memory? Mark On Sat, Aug 15, 2009 at 11:26 AM, Mathieu Rene <mrene_lists@avgs.ca> wrote:
Because switch_time_now() is in microseconds. Mathieu Rene Avant-Garde Solutions Inc Office: + 1 (514) 664-1044 x100 Cell: +1 (514) 664-1044 x200 mrene@avgs.ca
On 14-Aug-09, at 11:16 PM, Michael Jerris wrote:
task->runtime = switch_epoch_time_now(NULL) + 10; On Aug 14, 2009, at 10:19 PM, mark morreny wrote:
Hi Michael,
The following code was executed once, but not after the next 10 s.
SWITCH_STANDARD_SCHED_FUNC(data_flush_callback) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "starting to flush data buffer...\n");
task->runtime = switch_time_now() + 10; }
Any suggestion why?
Thanks, Mark On Sat, Aug 15, 2009 at 2:13 AM, Michael Jerris <mike@jerris.com> wrote:
thats in seconds. Mike
On Aug 14, 2009, at 8:32 AM, mark morreny wrote:
Hi,
Thank you for your help.
I get that too, but the callback does not execute the second time.
When I do task->runtime = switch_time_now() + 10;, what does +10 mean? Does it mean 10 s or 10 mins?
Thanks, Mark
On Wed, Aug 12, 2009 at 11:09 PM, Mathieu Rene <mrene_lists@avgs.ca>wrote:
Hi, I did the same thing on my side.... API CALL [load(mod_skel)] output: +OK
2009-08-12 11:08:18.37891 [DEBUG] switch_scheduler.c:214 Added task 2 data_flush (core) to run at 1250089698 2009-08-12 11:08:18.37891 [CONSOLE] switch_loadable_module.c:889 Successfully Loaded [mod_skel] 2009-08-12 11:08:18.37891 [NOTICE] switch_loadable_module.c:270 Adding API Function 'skel' freeswitch@Maths-Mac.local> 2009-08-12 11:08:18.207113 [ERR] mod_skel.c:120 starting to flush data buffer...
Note that you don't need to start the thread manually, the core already has threads running for the scheduler.
Mathieu Rene Avant-Garde Solutions Inc Office: + 1 (514) 664-1044 x100 Cell: +1 (514) 664-1044 x200 mrene@avgs.ca
On 12-Aug-09, at 7:26 AM, mark morreny wrote:
Hi,
In my LOAD_FUNCTION, I am trying to have freeswitch to flush out some data every 10 s. The following lines of code does not show any effect at all.
switch_scheduler_task_thread_start(); switch_scheduler_add_task(switch_epoch_time_now(NULL), data_flush_callback, "data_flush","core",0,NULL,SSHF_NONE|SSHF_NO_DEL);
SWITCH_STANDARD_SCHED_FUNC(data_flush_callback) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "starting to flush data buffer...\n");
task->runtime = switch_time_now() + 10;
}
Does anyone know how to get it to work?
Thanks, Mark
---------- Forwarded message ---------- From: Brian West <brian@freeswitch.org> Date: Mon, Aug 10, 2009 at 8:53 PM Subject: Re: [Freeswitch-users] Fwd: Scheduler in module To: freeswitch-users@lists.freeswitch.org
switch_rtp.c has a simple one for the zrtp cache storing.
/b
On Aug 10, 2009, at 7:13 AM, Michael Jerris wrote:
Re schedule is done in your callback, take a look at places that use these apis in the code for details.
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Sounds like you need to put a mutex on your scheduler routine. /b On Aug 18, 2009, at 10:18 AM, mark morreny wrote:
Hi,
Thank you very much. I am able to get my sched api to work now.
I still have one problem. I am getting core dump if freeswitch is shut down by typing in "shutdown" in the CLI. How can I control the shutdown process so that it will wait until all the existing sched jobs are done before starting to free the memory?
Mark
participants (5)
-
Brian West
-
mark morreny
-
Mathieu Rene
-
Michael Jerris
-
Moises Silva