Schedule events in C
-
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
-
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
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
-
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
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?