|
-
March 8th, 2011, 02:09 PM
#1
ask about multi threading in DLL
Hi,
I would like to provide several C APIs. The APIs will be included in a dll on windows 32 platform, written in C.
something like:
1: open(char* ip, char* port, void *session)
2: setvalue(void *session, double value)
3: readvalue(void *session, double *value)
4 close(void *session)
the caller will open first to get a session, then it can setvalue or getvalue, then close the session.
The problem is, for setvalue and readvalue, it will be called in a loop for 1000 or more times.
like
************************
open()
for (int i =0; i< 1000; i++) {
setvalue()
do something
getvalue()
}
close()
*************************
During the looping time, the client should send live message every certain period of time to keep the session live.
This live message should also be included in the DLL. (the writer of the caller program doesn't need to care about this.)
I don't know how I can implement the live message stuff ? What mechanism can be used to send the live message ?
Any suggestion is welcome, thanks.
Jerry
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|