Recent

Author Topic: Task scheduler for Lazarus  (Read 1294 times)

CynicRus

  • Jr. Member
  • **
  • Posts: 53
Task scheduler for Lazarus
« on: October 25, 2024, 11:25:18 pm »
Hello everyone.
Today I want to share with the community a fast and simple task scheduler. It supports both recurring and one-time tasks. It works on Windows, Linux, and it should work on macOS (though I haven't tested it yet). As documentation, I suggest looking at the example code.
The code is released under the BSD license.

Source code available here: https://github.com/CynicRus/laz_task_scheduler
« Last Edit: November 29, 2024, 04:55:46 pm by CynicRus »

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Task scheduler for Lazarus
« Reply #1 on: October 26, 2024, 12:05:04 pm »
* Mac Mini M1
* macOS 14.6.1
* Lazarus 3.99
* FPC 3.3.1

I've just tried this on macOS 14.6.1 and the build fails on a couple of lines, presumably something to do with the {$IFDEF}s. I notice that you've catered for DARWIN in other parts of the code, so presumably this was one that escaped your efforts 😉
Code: Pascal  [Select][+][-]
  1. job_scheduler.pas(530,5) Error: Identifier not found "clock_gettime"
  2. job_scheduler.pas(530,19) Error: Identifier not found "CLOCK_REALTIME"
  3.  
"It builds... ship it!"

CynicRus

  • Jr. Member
  • **
  • Posts: 53
Re: Task scheduler for Lazarus
« Reply #2 on: October 26, 2024, 11:15:44 pm »
Thank you for you time and the report! Fixed for MacOS now!

TRon

  • Hero Member
  • *****
  • Posts: 3756
Re: Task scheduler for Lazarus
« Reply #3 on: October 26, 2024, 11:34:26 pm »
linux:
Code: [Select]
Target OS: Linux for x86-64
Compiling laz_job_scheduler_sample.lpr
Compiling job_scheduler.pas
job_scheduler.pas(67,20) Error: Identifier not found "pthread_t"
job_scheduler.pas(67,29) Error: Error in type definition
job_scheduler.pas(175,1) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
pthread_t is located at baseunix (or actually unit unixtype)
« Last Edit: October 26, 2024, 11:40:36 pm by TRon »
I do not have to remember anything anymore thanks to total-recall.

CynicRus

  • Jr. Member
  • **
  • Posts: 53
Re: Task scheduler for Lazarus
« Reply #4 on: October 26, 2024, 11:42:15 pm »
linux:
Code: [Select]
Target OS: Linux for x86-64
Compiling laz_job_scheduler_sample.lpr
Compiling job_scheduler.pas
job_scheduler.pas(67,20) Error: Identifier not found "pthread_t"
job_scheduler.pas(67,29) Error: Error in type definition
job_scheduler.pas(175,1) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
pthread_t is located at baseunix (or actually unit unixtype)
Ah, thanks. I responded to the hint about unused unit in MacOS:) Fixed.

TRon

  • Hero Member
  • *****
  • Posts: 3756
Re: Task scheduler for Lazarus
« Reply #5 on: October 26, 2024, 11:58:40 pm »
Thank you CynicRus. Compiles and works  :)
I do not have to remember anything anymore thanks to total-recall.

CynicRus

  • Jr. Member
  • **
  • Posts: 53
Re: Task scheduler for Lazarus
« Reply #6 on: October 27, 2024, 12:08:57 am »
Thank you CynicRus. Compiles and works  :)
Thank you for taking the time to test it!)

 

TinyPortal © 2005-2018