Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Schedule events in C

Schedule events in C

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminlinuxhelptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 703562
    wrote on last edited by
    #1

    Hay, I looking for open source code in c language which schedule/deschdule a functions that will run in a new threads, so for example I can schedule the function to run every 30 minutes in new tread. I want to use this source in my program as an infrastructure service. I prefer using a source which will compiled on Linux and Windows platforms. Please, any help - link

    M 1 Reply Last reply
    0
    • U User 703562

      Hay, I looking for open source code in c language which schedule/deschdule a functions that will run in a new threads, so for example I can schedule the function to run every 30 minutes in new tread. I want to use this source in my program as an infrastructure service. I prefer using a source which will compiled on Linux and Windows platforms. Please, any help - link

      M Offline
      M Offline
      malaugh
      wrote on last edited by
      #2

      You mean code to create a thread? just use DownlinkThread = CreateThread( NULL, // default security attributes 0, // use default stack size Func, // thread function 0, // argument to thread function 0, // use default creation flags &MsgThreadId); // thread identifier The thread function is WORD WINAPI Func( LPVOID lpParam ) { while(1) { Sleep(30 * 60 * 1000); } return(0); } Substitute CreateThread with pthread_create and Sleep with uSleep for the Linux version

      U 1 Reply Last reply
      0
      • M malaugh

        You mean code to create a thread? just use DownlinkThread = CreateThread( NULL, // default security attributes 0, // use default stack size Func, // thread function 0, // argument to thread function 0, // use default creation flags &MsgThreadId); // thread identifier The thread function is WORD WINAPI Func( LPVOID lpParam ) { while(1) { Sleep(30 * 60 * 1000); } return(0); } Substitute CreateThread with pthread_create and Sleep with uSleep for the Linux version

        U Offline
        U Offline
        User 703562
        wrote on last edited by
        #3

        I know how to di it, I looking for more complicated thread events infrastructure which I can schedule to promise order and timing of events. What aboute to schdule event to run (every 30 seconds, or to kill all created threads in one time. I looking for the source of it as part of sharing code via the internet, and also learn new ideas. BTW I found till now the "cheap thread" - a library of portable C routines to implement cooperative multitasking with prioritized scheduling, but they actully not using thread creation. Any other links?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups