Running multiple thread instances of the same function. (See MultiThread Program for an example on how to use it)
Dependents: MutliThread Server_Multi_Client HelloWorld C027_SupportTest ... more
Threads.h@3:d370bed31f45, 2013-06-29 (annotated)
- Committer:
- lemniskata
- Date:
- Sat Jun 29 22:59:46 2013 +0000
- Revision:
- 3:d370bed31f45
- Parent:
- 2:46b56c9086f2
Running multiple thread instances of the same function. New thread is started only if there are less than MAX non-inactive threads
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lemniskata | 0:266b0dc4f8d0 | 1 | /* |
lemniskata | 0:266b0dc4f8d0 | 2 | ** File name: Thread.cpp |
lemniskata | 0:266b0dc4f8d0 | 3 | ** Descriptions: Creates multiple thread instances of the same function |
lemniskata | 0:266b0dc4f8d0 | 4 | ** |
lemniskata | 0:266b0dc4f8d0 | 5 | **------------------------------------------------------------------------------------------------------ |
lemniskata | 0:266b0dc4f8d0 | 6 | ** Created by: Ivan Shindev |
lemniskata | 0:266b0dc4f8d0 | 7 | ** Created date: 06/29/2013 |
lemniskata | 0:266b0dc4f8d0 | 8 | ** Version: 1.0 |
lemniskata | 0:266b0dc4f8d0 | 9 | ** Descriptions: The original version |
lemniskata | 0:266b0dc4f8d0 | 10 | ** |
lemniskata | 0:266b0dc4f8d0 | 11 | **------------------------------------------------------------------------------------------------------ |
lemniskata | 0:266b0dc4f8d0 | 12 | ** Modified by: |
lemniskata | 0:266b0dc4f8d0 | 13 | ** Modified date: |
lemniskata | 0:266b0dc4f8d0 | 14 | ** Version: |
lemniskata | 0:266b0dc4f8d0 | 15 | ** Descriptions: |
lemniskata | 0:266b0dc4f8d0 | 16 | */ |
lemniskata | 0:266b0dc4f8d0 | 17 | #ifndef __Threads_H |
lemniskata | 0:266b0dc4f8d0 | 18 | #define __Threads_H |
lemniskata | 0:266b0dc4f8d0 | 19 | |
lemniskata | 0:266b0dc4f8d0 | 20 | #include "mbed.h" |
lemniskata | 0:266b0dc4f8d0 | 21 | #include "cmsis_os.h" |
lemniskata | 0:266b0dc4f8d0 | 22 | |
lemniskata | 2:46b56c9086f2 | 23 | typedef struct ThreadList |
lemniskata | 2:46b56c9086f2 | 24 | { |
lemniskata | 2:46b56c9086f2 | 25 | osThreadDef_t *thread; |
lemniskata | 2:46b56c9086f2 | 26 | osThreadId id; |
lemniskata | 2:46b56c9086f2 | 27 | struct ThreadList* nextThread; |
lemniskata | 2:46b56c9086f2 | 28 | }ThreadList; |
lemniskata | 2:46b56c9086f2 | 29 | |
lemniskata | 3:d370bed31f45 | 30 | int initThread(ThreadList **addresOfTL,os_pthread pthread,ThreadList** addresOfThread,int max); |
lemniskata | 2:46b56c9086f2 | 31 | |
lemniskata | 0:266b0dc4f8d0 | 32 | #endif |