epicsMaxThreads is new

This commit is contained in:
Marty Kraimer
2004-10-07 13:21:40 +00:00
parent 36733cd907
commit b0a654b4c1
3 changed files with 86 additions and 0 deletions
+4
View File
@@ -47,6 +47,10 @@ epicsThreadPrivateTestHost_SRCS += epicsThreadPrivateTestMain.cpp epicsThreadPri
PROD_HOST += epicsThreadPrivateTestHost
OBJS_IOC_vxWorks += epicsThreadPrivateTest
epicsMaxThreadsHost_SRCS += epicsMaxThreadsMain.cpp epicsMaxThreads.c
PROD_HOST += epicsMaxThreadsHost
OBJS_IOC_vxWorks += epicsMaxThreads
epicsOkToBlockTestHost_SRCS += epicsOkToBlockTestMain.cpp epicsOkToBlockTest.cpp
PROD_HOST += epicsOkToBlockTestHost
OBJS_IOC_vxWorks += epicsOkToBlockTest
+53
View File
@@ -0,0 +1,53 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* epicsMaxThreads.cpp */
/* Author: Marty Kraimer Date: 09JUL2004*/
#include <stddef.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include "epicsThread.h"
#include "epicsEvent.h"
#include "epicsExit.h"
#include "errlog.h"
static epicsEventId started;
static void thread(void *arg)
{
epicsEventSignal(started);
epicsThreadSuspendSelf();
}
void epicsMaxThreads(void)
{
unsigned int stackSize;
epicsThreadId id;
int i = 0;
stackSize = epicsThreadGetStackSize(epicsThreadStackSmall);
errlogPrintf("stackSize %d\n",stackSize);
errlogFlush();
started = epicsEventMustCreate(epicsEventEmpty);
while(1) {
id = epicsThreadCreate("thread",50,stackSize,thread,0);
if(!id) break;
i++;
epicsEventMustWait(started);
}
fprintf(stdout,"number threads %d\n",i);
epicsExitCallAtExits();
}
+29
View File
@@ -0,0 +1,29 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* epicsMaxThreadsMain.cpp */
/* Author: Marty Kraimer Date: 26JAN2000 */
#include <stddef.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
extern "C" void epicsMaxThreads(void);
int main(int argc,char *argv[])
{
epicsMaxThreads();
printf("main terminating\n");
return(0);
}