Announcement

Collapse
No announcement yet.

[os] sleep emulated via alarm + pause - makefile

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [os] sleep emulated via alarm + pause - makefile

    main
    PHP Code:
    /*
     *
     *
     *  Sample Function
     *
     */

    #include <st***.h>
    #include "main_header.h"

    int main void ) {
        
        for(;-
    1;){
            
            
    fprintf(stdout,"Dormo per 2 sec ...\n");
            
    xsleep(2);
            
    fprintf(stdout,"Eccomi. Dormo per altri 2 sec ...\n");
            
        }
        
        return 
    0;

    main_header
    PHP Code:
    void xsleep int n); 
    xsleep
    PHP Code:
    #include <unistd.h>
    #include <st***.h>
    #include <signal.h>


    void xsleep_action int signal ){}


    void xsleep int n ) {
        
        
        
    struct sigaction sigalrm_action;
            
    sigalrm_action.sa_handler xsleep_action;
            
    sigalrm_action.sa_flags0;
        
        
    sigaction(SIGALRM,&sigalrm_action,NULL);
        
        
    alarm(n);
        
    pause();
        

    makefile
    PHP Code:
    all:main.o xsleep.o
        gcc 
    -o exec main.o xsleep.o
    main
    .o:main.c main_header.h
        gcc 
    --o main.o main.c
    xsleep
    .o:xsleep.c
        gcc 
    --o xsleep.o xsleep.
    | VFX Artist, C++ Programmer, HW Overclocker | Web: xgiovio.com Email: xgiovio@gmail.com Twitter: @xgiovio
Working...
X

Google Profile


My name is Giovanni Di Grezia, but people call me xgiovio.

Here is my homepage:.

I'm a VFX Artist and Software Developer.

Giovanni Di Grezia