Rodrigo Canellas wrote:
> Hi,
>
> In my test program, in the beginning of every test I call '
> MSCListTokens' and then 'MSCEstablishConnection', and in the end I call
> 'MSCReleaseConnection'.
>
> When I run two tests in a roll, the second always fails.
>
> I followed the code and I found out that this happens because
> 'localHContext' is not set to 0 in 'MSCReleaseConnection', only in
> 'musclecard_fini', which is only called when the MUSCLE lib is unloaded.
I have tried the following:
{
rv = MSCListTokens(MSC_LIST_SLOTS, tokenList, &tokenSize);
tokenList = (MSCLPTokenInfo) malloc(sizeof(MSCTokenInfo) * tokenSize);
rv = MSCListTokens(MSC_LIST_SLOTS, tokenList, &tokenSize);
rv = MSCEstablishConnection(&tokenList[2], MSC_SHARE_SHARED,
AID, 7, &pConnection);
free(tokenList);
tokenList = NULL;
rv = MSCReleaseConnection(&pConnection, MSC_LEAVE_TOKEN);
rv = MSCListTokens(MSC_LIST_SLOTS, tokenList, &tokenSize);
tokenList = (MSCLPTokenInfo) malloc(sizeof(MSCTokenInfo) * tokenSize);
rv = MSCListTokens(MSC_LIST_SLOTS, tokenList, &tokenSize);
rv = MSCEstablishConnection(&tokenList[2], MSC_SHARE_SHARED,
AID, 7, &pConnection);
free(tokenList);
tokenList = NULL;
rv = MSCReleaseConnection(&pConnection, MSC_LEAVE_TOKEN);
rv = MSCListTokens(MSC_LIST_SLOTS, tokenList, &tokenSize);
tokenList = (MSCLPTokenInfo) malloc(sizeof(MSCTokenInfo) * tokenSize);
rv = MSCListTokens(MSC_LIST_SLOTS, tokenList, &tokenSize);
rv = MSCEstablishConnection(&tokenList[2], MSC_SHARE_SHARED,
AID, 7, &pConnection);
free(tokenList);
tokenList = NULL;
rv = MSCReleaseConnection(&pConnection, MSC_LEAVE_TOKEN);
}
and it works. What method does fail and when? Settign tokenList = NULL;
is important.
>
> Therefore, I inserted the line
>
> "
> localHContext = 0;
> "
>
> at the end of 'MSCReleaseConnection', right after
> "
> pConnection->hContext = 0;
> "
>
> and before
> "
> pConnection->shareMode = 0;
> "
>
> and now I can run as many tests I want, without stopping my test program.
>
>
> If I what I did is correct, how can this become part of the official
> MUSCLE code?
Can be applied to the SVN, if it is really an error. Actually this
should make the library more effcient, because it is only once necessary
to establish a context to the system.
Regards,
Karsten
>
>
> Thanks,
>
>
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle