IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18748


Ignore:
Timestamp:
Jul 25, 2008, 5:47:14 PM (18 years ago)
Author:
eugene
Message:

add pswarpThreadLauncher

Location:
branches/eam_branch_20080719/pswarp/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080719/pswarp/src/Makefile.am

    r18622 r18748  
    1717        pswarpSetMaskBits.c             \
    1818        pswarpTransformReadout_Opt.c    \
     19        pswarpThreadLauncher.c          \
    1920        pswarpVersion.c           
    2021
  • branches/eam_branch_20080719/pswarp/src/pswarp.c

    r17781 r18748  
    1616
    1717    psLibInit(NULL);
     18
     19    // create the thread pool with 4 threads, supplying our thread launcher function
     20    psThreadPoolInit (4, &pswarpThreadLauncher);
     21   
     22    srand48(0);
     23
     24    for (int i = 0; i < 10; i++) {
     25        // allocate a job which takes two arguments
     26        // XXX probably don't need to pre-specify the number of args
     27        psThreadJob *job = psThreadJobAlloc ("THREAD_TEST", 2);
     28
     29        // construct the arguments for this job
     30        char *arg1 = NULL;
     31        char *arg2 = NULL;
     32        psStringAppend (&arg1, "arg1.%d", i);
     33        psStringAppend (&arg2, "arg2.%d", i);
     34        psArrayAdd (job->args, 1, arg1);
     35        psArrayAdd (job->args, 1, arg2);
     36
     37        psThreadJobAddToQueue (job);
     38    }
     39    if (!psThreadPoolWait ()) {
     40        fprintf (stderr, "error in a threaded job\n");
     41        exit (1);
     42    }
     43    fprintf (stderr, "success for threaded jobs\n");
     44    exit (0);
    1845
    1946    // model inits are needed in pmSourceIO
  • branches/eam_branch_20080719/pswarp/src/pswarp.h

    r18622 r18748  
    6868    );
    6969
     70// thread launcher for this program
     71void *pswarpThreadLauncher (void *data);
Note: See TracChangeset for help on using the changeset viewer.