Ariane Soft PPL2 Pocket Programming DataMite
  #41  
Old 10-18-2009, 11:03 AM
juppmaifeld juppmaifeld is offline
Member
 
Join Date: Aug 2009
Posts: 43
Default

Hi Kornalius, hi NickNack

yes it also sounds good for me. I would like to do some tests with PPL 1.6. Where can I download it or how can I update my PPL 1.53 Pro version to PPL 1.6? Are also the the problems with thread synchronization like the "critical section" stuff, what was the start topic of this thread, solved in PPL 1.6?

Regards,

Jupp
Reply With Quote
  #42  
Old 10-23-2009, 12:44 AM
kornalius kornalius is offline
Administrator
 
Join Date: Apr 2006
Posts: 551
Default Re: Using Thread's in PPL

Critical sections should work fine. I have nit tested them. Please contact me via support@ArianeSoft.ca and I will be able to test it with you.

1.6 is not available yet. It will be a free upgrade.
__________________
Regards,
Alain Deschenes
ArianeSoft Inc.
http://www.arianesoft.ca
Reply With Quote
  #43  
Old 11-10-2009, 05:39 PM
juppmaifeld juppmaifeld is offline
Member
 
Join Date: Aug 2009
Posts: 43
Thumbs down

Hi Kornalius,

thank you for testing the demos concerning the PPL problems with multi-threading. It is interesting to hear that the multi-threading demo and the demo for critical section work fine with PPL version 1.6 and 2.2 but that does help me and all the other PPL users not very much as long as these versions are not available to the users. I do (and also others) spend a lot of time to figure out what works with PPL and what not and to find and develop workarounds where PPL doesn't work as it should. Time is money. So it is not more than fair to provide these PPL versions to the users as soon as possible. At least you should tell us an accurate date when these versions are available to the users who have paid for it.

Regards

Jupp
Reply With Quote
  #44  
Old 11-10-2009, 06:49 PM
kornalius kornalius is offline
Administrator
 
Join Date: Apr 2006
Posts: 551
Default

I am done with 2.2 and 1.60 I am waiting for the tutorial book to be finished (doing primarily reviewing these days).

1.60 needs to be ready for release, we need some more testing to make everything is fine with it.

I won't give a date since most of the time, I slip and everyone gets mad at me for that
__________________
Regards,
Alain Deschenes
ArianeSoft Inc.
http://www.arianesoft.ca
Reply With Quote
  #45  
Old 01-24-2010, 02:03 PM
juppmaifeld juppmaifeld is offline
Member
 
Join Date: Aug 2009
Posts: 43
Smile TryEnterCriticalSection still dosen't work!

Hi Kornalius,
Hi Nicknack ,

I did some tests with ppl 1.62 concerning threads and synchronisation. The outcome of these tests are:
1. EnterCriticalSection and LeaveCriticalSection appears to work now.
2. WaitForMultipleObjects appears to work. The declaration of WaitForMultipleObjects in windows.ppl has only 2 input parameters. I think this must be an error in windows.ppl. In my test prog I used this declaration
#declare myWaitForMultipleObjects kndll WaitForMultipleObjects 4 1
and it worked.
3. TryEnterCriticalSection doesn't work. It causes an memory access violation.
4. I didn't find any documentation or demos in ppl 1.62 concerning the new threading functions

CreateThread()
Threads()
CurrentThread()
MainThread()
ThreadHandle()
ThreadId()
ThreadEventHandle()

you announced in one of the posts in this thread.

5. Because ppl 1.62 and ppl 2.x share the same core the results should also be of relevance for ppl 2.x

6. I attached the test prog directly to this post because I have written some comments to the prog concerning the problems with TryEnterCriticalSection and the expected results. So everyone can copy it from here to the pide(ppl1.62) and just do a RUN.

Jupp

//--Start Test Prog ------------------------------------------------------

#declare TryEnterCriticalSection kndll TryEnterCriticalSection 1 1
#declare InitializeCriticalSection kndll InitializeCriticalSection 1 0
#declare InitializeCriticalSectionEx kndll InitializeCriticalSectionEx 3 1
#declare InitializeCriticalSectionAndSpinCount kndll InitializeCriticalSectionAndSpinCount 2 1
#declare EnterCriticalSection kndll EnterCriticalSection 1 0
#declare LeaveCriticalSection kndll LeaveCriticalSection 1 0
#declare DeleteCriticalSection kndll DeleteCriticalSection 1 0

// WaitForMultipleObjects in windows.ppl has only 2 input parameters ??? must be an error in windows.ppl???
#declare myWaitForMultipleObjects kndll WaitForMultipleObjects 4 1

/*
#ifdef _WIN32_WCE
#define CRITICAL_SECTION {"LockCount","OwnerThread","hCrit","needtrap","dwR eserved"}
// not tested yet
#else
*/
#define CRITICAL_SECTION {"DebugInfo","LockCount","RecursionCount","OwningT hread","LockSemaphore","SpinCount"}
//#endif


//--Thread 1 --------------------------------------------------
func TestThread1Proc(parameter$)
local(t1$);

for (i1$, 0, 1000, 1)

/*
If EnterCriticalSection and LeaveCriticalSection are working correct,
threadCount$ must be 0 when TestThread1Proc and TestThread2Proc are finished

*/
EnterCriticalSection(&mycs$);
t1$ = threadCount$ - 1;
sleep(1);
threadCount$ = t1$;
LeaveCriticalSection(&mycs$);

end;
stop1$ = TRUE;
return (0);
end;

//--End Thread 1 -----------------------------------------------


//--Thread 2 --------------------------------------------------
func TestThread2Proc(parameter$)

local(t2$);

for (i2$, 0, 1000, 1)
/*
If EnterCriticalSection and LeaveCriticalSection are working correct,
threadCount$ must be 0 when TestThread1Proc and TestThread2Proc are finished

*/
EnterCriticalSection(&mycs$);
t2$ = threadCount$ + 1;
sleep(1);
threadCount$ = t2$;
LeaveCriticalSection(&mycs$);

end;

stop2$ = TRUE;
return (0);
end;

//--End Thread 2 -----------------------------------------------

//--Thread 3 --------------------------------------------------
func TestThread3Proc(parameter$)

While (1)
if (stop1$ & stop2$) // Stop if thread 1 and thread 2 are finished
break;
else
if (TryEnterCriticalSection(&mycs$) == FALSE) //!!!!! see comments below
tryCSCountFALSE$ += 1;
else
tryCSCountTRUE$ += 1;
LeaveCriticalSection(&mycs$);
end;
end;

//sleep(1);

/*
The sleep(t) command above is just for test purpose.

-> without the sleep command or with 1 ms sleep time we often get a memory access violation
-> change the time to 10 ms and TryEnterCriticalSection works more often than not
-> change the time to 100 ms and TryEnterCriticalSection works

*/
end;

return (0);
end;



//--End Thread 3 -----------------------------------------------


proc Main

local(resultWFMO$, s$);

SDIM(TestThreadid$, TUINT, 3);
SDIM(TestThreadHandle$, TUINT, 3);

global(mycs$);
struct(mycs$, CRITICAL_SECTION);

mySpinCount$ = 0;

global(threadCount$, tryCSCountFALSE$, tryCSCountTRUE$, stop1$, stop2$);

threadCount$ = 0;
tryCSCountFALSE$ = 0;
tryCSCountTRUE$ = 0;

ShowMessage("MainThread: Start InitializeCriticalSection");
InitializeCriticalSection(&mycs$);

ShowMessage("MainThread: Create testthread 1+2+3 and start the test");


/*CreateThreat is not defined in windows.ppl.
Must be declared somewhere in the system deepness of PPL.
CreateThread from the DEMO examples accepts only 5 input parameters.
The input parameter for the stack size is missing (maybe that's the reason why it is declared somewhere in the system deepness of PPL).
Declearing CreateThread with 6 input parameters like it is defined at MSDN dosent work.

#declare CreatThread kndll CreateThread 6 1 //

Produces Compiler error: Invalid number of input parameters at 'CREATETHREAD'

*/

TestThreadHandle$[0] = CreateThread(STANDARD_RIGHTS_ALL, &TestThread1Proc, 0, 0, &TestThreadid$[0]);
TestThreadHandle$[1] = CreateThread(STANDARD_RIGHTS_ALL, &TestThread2Proc, 0, 0, &TestThreadid$[1]);
TestThreadHandle$[2] = CreateThread(STANDARD_RIGHTS_ALL, &TestThread3Proc, 0, 0, &TestThreadid$[2]);


// WaitForMultipleObjects appears to work now. That's great. I didn't test WaitForSingleObject so far
new(resultWFMO$, TUINT);
resultWFMO$ = myWaitForMultipleObjects(3, TestThreadHandle$, TRUE, INFINITE);

if (resultWFMO$ == WAIT_FAILED)
erroresultWFMO$ = GetLastError();
ShowMessage("MainThread: myWaitForMultipleObjects -> error = " + erroresultWFMO$);
else

Case (resultWFMO$)
0x00000080:
s$ = "WAIT_ABANDONED";
0x00000000:
s$ = "WAIT_OBJECT_0";
0x00000102:
s$ = "WAIT_TIMEOUT";
default:
s$ = "UNKNOWN";
end;

end;

if (threadCount$ == 0)
ShowMessage("MainThread:" + "\n" + "Stoped with: " + s$ + ", " + resultWFMO$ + "\n" + "Thread 1: stop1$ = " + stop1$ + "\n" + "Thread 2: stop2$ = " + stop2$ + "\n" + "Thread 3: tryCSCountTRUE$ = " + tryCSCountTRUE$ + "\n" + "Thread 3: tryCSCountFALSE$ = " + tryCSCountFALSE$ + "\n\n" + "threadCount$ = " + threadCount$ + " -> OK!!");
else
ShowMessage("MainThread:" + "\n" + "Stoped with: " + s$ + ", " + resultWFMO$ + "\n" + "Thread 1: stop1$ = " + stop1$ + "\n" + "Thread 2: stop2$ = " + stop2$ + "\n" + "Thread 3: tryCSCountTRUE$ = " + tryCSCountTRUE$ + "\n" + "Thread 3: tryCSCountFALSE$ = " + tryCSCountFALSE$ + "\n\n" + "threadCount$ = " + threadCount$ + " -> FALSE!!");
end;

DeleteCriticalSection(&mycs$);
free(TestThreadid$, TestThreadHandle$);


end;

Last edited by juppmaifeld; 01-24-2010 at 02:10 PM.
Reply With Quote
  #46  
Old 01-26-2010, 08:07 PM
Nicknack Nicknack is offline
Senior Member
 
Join Date: Nov 2006
Location: Germany
Posts: 527
Default

just did some runs and no errors occured, but I haven't checked the values, though.
Reply With Quote
  #47  
Old 01-27-2010, 10:21 AM
juppmaifeld juppmaifeld is offline
Member
 
Join Date: Aug 2009
Posts: 43
Smile

Hi NickNack,

I am a little bit astonished that you don't get an error message.
See attached the error message I get when I run the prog on my pc.
I did the tests with ppl 1.62 under win7.

I also did test the prog on my IPAQ 2790 under WinMobile 5.0. There I have an other problem with calling myWaitForMultipleObjects. I always get the windows error code 87, "The parameter is incorrect." . At the moment I don't know the reason for that. Maybe this problem is linked to the declaration of WaitForMultipleObjects with only 2 parameters in windows.ppl.

By the way. What's your opinion about the WaitForMultipleObjects declaration in windows.ppl and do you have any idea where to find the new thread functions (my 4.th question) in ppl1.62 ?

Maybe Kornalius could help us with some infos.

Schöne Grüße aus der z.Zt. sehr kalten und verschneiten Eifel.

Jupp
Attached Thumbnails
Click image for larger version

Name:	ThreadErrorMessage.JPG
Views:	124
Size:	26.9 KB
ID:	318  
Reply With Quote
  #48  
Old 01-30-2010, 10:46 AM
Nicknack Nicknack is offline
Senior Member
 
Join Date: Nov 2006
Location: Germany
Posts: 527
Default

I did several runs with v1.62 and v2.21 on WinXp and it always works (only one other easily fixed error on 2.21). stop1$ and stop2$ are 1 and tryCsCounttrue$ is 0 (except with v2.21 and no sleep, then tryCsCounttrue$ is 1).
WaitForMultipleObject's declaration seems to be a typo and I also don't know where you can find help about the new functions although they are implemented.
bei uns im ruhrgebiet sind heute auch schon wieder ca 10 cm gefallen, der winter will anscheinend nicht aufhören

Last edited by Nicknack; 01-30-2010 at 10:56 AM.
Reply With Quote
  #49  
Old 01-30-2010, 12:53 PM
juppmaifeld juppmaifeld is offline
Member
 
Join Date: Aug 2009
Posts: 43
Default

Hi Nicknack,

I am wondering more and more. Because on my windows XP laptop ppl 1.53 is installed (which I still use to develop my application because ppl 1.62 is still not "perfect" yet, but almost ) I took my son's "Eee Pc" laptop with win XP and installed ppl 1.62 on it. When I run the test prog I always (tried it more then 10 times) got the error with tryentercriticalsection as I described it in my last post. So it seems to be we are living in different worlds. But why? Maybe other ppl users out there in the ppl world can help and test the prog on different plattforms and post their results here. Maybe Kornalius has any idea concerning the problem if he isn't to busy with other work.

Best regards

Jupp
Reply With Quote
  #50  
Old 01-30-2010, 02:01 PM
Nicknack Nicknack is offline
Senior Member
 
Join Date: Nov 2006
Location: Germany
Posts: 527
Default

ohh I got now one time this error, but I can't reproduce it. I had more than one prog running simultaneous, first time I did it by mistake and the error occurs, afterwards I run more than 20 progs and nothing special happened
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:07 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (c) ArianeSoft Inc.
Copyright © 2009 www.ppl-lang.com - All rights reserved
Web Design by BR Web Consulting Ltd