libCom: actually use libComAPI.h in libCom

This commit is contained in:
Michael Davidsaver
2020-05-20 13:38:09 -07:00
parent b2750bbe93
commit 799e72b1e3
250 changed files with 1286 additions and 1434 deletions

View File

@@ -13,7 +13,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "shareLib.h"
#include "libComAPI.h"
#include "errMdef.h"
#define S_pool_jobBusy (M_pool| 1) /*Job already queued or running*/
@@ -59,24 +59,24 @@ typedef struct epicsJob epicsJob;
* This much be done to preserve future compatibility
* when new options are added.
*/
epicsShareFunc void epicsThreadPoolConfigDefaults(epicsThreadPoolConfig *);
LIBCOM_API void epicsThreadPoolConfigDefaults(epicsThreadPoolConfig *);
/* fetch or create a thread pool which can be shared with other users.
* may return NULL for allocation failures
*/
epicsShareFunc epicsThreadPool* epicsThreadPoolGetShared(epicsThreadPoolConfig *opts);
epicsShareFunc void epicsThreadPoolReleaseShared(epicsThreadPool *pool);
LIBCOM_API epicsThreadPool* epicsThreadPoolGetShared(epicsThreadPoolConfig *opts);
LIBCOM_API void epicsThreadPoolReleaseShared(epicsThreadPool *pool);
/* If opts is NULL then defaults are used.
* The opts pointer is not stored by this call, and may exist on the stack.
*/
epicsShareFunc epicsThreadPool* epicsThreadPoolCreate(epicsThreadPoolConfig *opts);
LIBCOM_API epicsThreadPool* epicsThreadPoolCreate(epicsThreadPoolConfig *opts);
/* Blocks until all worker threads have stopped.
* Any jobs still attached to this pool receive a callback with EPICSJOB_CLEANUP
* and are then orphaned.
*/
epicsShareFunc void epicsThreadPoolDestroy(epicsThreadPool *);
LIBCOM_API void epicsThreadPoolDestroy(epicsThreadPool *);
/* pool control options */
typedef enum {
@@ -84,7 +84,7 @@ typedef enum {
epicsThreadPoolQueueRun /* val==0 prevents workers from running jobs, 1 is default */
} epicsThreadPoolOption;
epicsShareFunc void epicsThreadPoolControl(epicsThreadPool* pool,
LIBCOM_API void epicsThreadPoolControl(epicsThreadPool* pool,
epicsThreadPoolOption opt,
unsigned int val);
@@ -94,7 +94,7 @@ epicsShareFunc void epicsThreadPoolControl(epicsThreadPool* pool,
* timeout<0 waits forever, timeout==0 polls, timeout>0 waits at most one timeout period
* Returns 0 for success or non-zero on error (timeout is ETIMEOUT)
*/
epicsShareFunc int epicsThreadPoolWait(epicsThreadPool* pool, double timeout);
LIBCOM_API int epicsThreadPoolWait(epicsThreadPool* pool, double timeout);
/* Per job operations */
@@ -105,7 +105,7 @@ epicsShareFunc int epicsThreadPoolWait(epicsThreadPool* pool, double timeout);
* will be the epicsJob*
*/
#define EPICSJOB_SELF epicsJobArgSelfMagic
epicsShareExtern void* epicsJobArgSelfMagic;
LIBCOM_API extern void* epicsJobArgSelfMagic;
/* Creates, but does not add, a new job.
* If pool is NULL then the job is not associated with any pool and
@@ -113,7 +113,7 @@ epicsShareExtern void* epicsJobArgSelfMagic;
* Safe to call from a running job function.
* Returns a new job pointer, or NULL on error.
*/
epicsShareFunc epicsJob* epicsJobCreate(epicsThreadPool* pool,
LIBCOM_API epicsJob* epicsJobCreate(epicsThreadPool* pool,
epicsJobFunction cb,
void* user);
@@ -121,7 +121,7 @@ epicsShareFunc epicsJob* epicsJobCreate(epicsThreadPool* pool,
* Job may not be immediately free'd.
* Safe to call from a running job function.
*/
epicsShareFunc void epicsJobDestroy(epicsJob*);
LIBCOM_API void epicsJobDestroy(epicsJob*);
/* Move the job to a different pool.
* If pool is NULL then the job will no longer be associated
@@ -129,13 +129,13 @@ epicsShareFunc void epicsJobDestroy(epicsJob*);
* Not thread safe. Job must not be running or queued.
* returns 0 on success, non-zero on error.
*/
epicsShareFunc int epicsJobMove(epicsJob* job, epicsThreadPool* pool);
LIBCOM_API int epicsJobMove(epicsJob* job, epicsThreadPool* pool);
/* Adds the job to the run queue
* Safe to call from a running job function.
* returns 0 for success, non-zero on error.
*/
epicsShareFunc int epicsJobQueue(epicsJob*);
LIBCOM_API int epicsJobQueue(epicsJob*);
/* Remove a job from the run queue if it is queued.
* Safe to call from a running job function.
@@ -143,15 +143,15 @@ epicsShareFunc int epicsJobQueue(epicsJob*);
* 1 if job already ran, is running, or was not queued before,
* Other non-zero on error
*/
epicsShareFunc int epicsJobUnqueue(epicsJob*);
LIBCOM_API int epicsJobUnqueue(epicsJob*);
/* Mostly useful for debugging */
epicsShareFunc void epicsThreadPoolReport(epicsThreadPool *pool, FILE *fd);
LIBCOM_API void epicsThreadPoolReport(epicsThreadPool *pool, FILE *fd);
/* Current number of active workers. May be less than the maximum */
epicsShareFunc unsigned int epicsThreadPoolNThreads(epicsThreadPool *);
LIBCOM_API unsigned int epicsThreadPoolNThreads(epicsThreadPool *);
#ifdef __cplusplus
}