Pharo-users
By thread
pharo-users@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- 7 participants
- 50354 messages
Temporary files
by Valentin Ryckewaert
Hello everyone,
I would like to use a temporary file for a project and I didn't find an
existing method.
I'm asking my self if it's a better idea to use ffi or OSSubProcess (or
something already build for it) to build a method able to create this tmp
file.
Someone could help me please?
PS : Should it be a good idea to add this method directly in Pharo ?
May 11, 2016
Keystroke in ComposableModel
by Khrystyna Mykhailiuk
Hello!
I would like to implement some shortcuts at the window of an object of
ComposableModel class.
Can anybody help me to understand which methods I should override?
--
View this message in context: http://forum.world.st/Keystroke-in-ComposableModel-tp4894301.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
May 11, 2016
SPLASH-I 2016: Call for Talk Proposals!
by Tijs van der Storm
SPLASH-I: Innovation, Interaction, Insight, Industry, Invited
The ACM SIGPLAN conference on Systems, Programming, Languages and
Applications: Software for Humanity (SPLASH) embraces all aspects of
software construction and delivery to make it the premier conference at the
intersection of programming, languages, and software engineering. SPLASH
2016 will take place from Sunday, October 30 to Friday, November 4, 2016 in
Amsterdam, The Netherlands.
SPLASH-I is the track of SPLASH dedicated to great talks on exciting
topics! SPLASH-I will run in parallel with all of SPLASH (during the week
days), and is open to all attendees. SPLASH-I will host both invited talks
and selected talks submitted via this call for proposals. SPLASH-I solicits
inspiring talks, tutorials and demonstrations on exciting topics related to
programming and programming systems, delivered by excellent speakers from
academia or industry.
SPLASH-I caters for three categories of presentations:
- Regular talks on programming languages, systems or concepts;
- Tutorials aimed at introducing particular tools, systems, or languages
- Demonstrations showing off cool programming technology.
All slots in SPLASH-I are 45 minutes.
Please submit proposals here: http://goo.gl/forms/FZqQwpd73G
Have a suggestion for a great speaker and topic? Suggest it here:
http://goo.gl/forms/MWzgStWkww
SPLASH-I maintains two deadlines: 1st of June, and, if there are still
slots available, 1st of August.
Websites: http://2016.splashcon.org/track/splash-2016-splash-i
Organization: Eelco Visser (TU Delft), Tijs van der Storm (CWI)
Committee:
- Matthias Hauswirth (University of Lugano)
- Igor Peshansky (Google)
- Tiark Rompf (Purdue & Oracle Labs)
- Jurgen Vinju (CWI)
May 11, 2016
Re: [Pharo-users] Pharo-users Digest, Vol 37, Issue 28
by Vince Refiti
test
On Wed, May 11, 2016 at 9:00 AM, <pharo-users-request(a)lists.pharo.org>
wrote:
> Send Pharo-users mailing list submissions to
> pharo-users(a)lists.pharo.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>
> http://lists.pharo.org/mailman/listinfo/pharo-users_lists.pharo.org
> or, via email, send a message with subject or body 'help' to
> pharo-users-request(a)lists.pharo.org
>
> You can reach the person managing the list at
> pharo-users-owner(a)lists.pharo.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Pharo-users digest..."
>
>
> Today's Topics:
>
> 1. Re: Semaphore wait and signal (Ben Coman)
> 2. Re: (no subject) (Ben Coman)
> 3. Re: (no subject) (phil(a)highoctane.be)
> 4. SPLASH 2016: Call for Sponsorships (Tijs van der Storm)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 11 May 2016 00:28:32 +0800
> From: Ben Coman <btc(a)openinworld.com>
> To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
> Subject: Re: [Pharo-users] Semaphore wait and signal
> Message-ID:
> <CAProBTnUgFZBiGqi3QdamUdG=
> TsKMcyNyoPSNhTpS2D0zG3Jvg(a)mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> On Tue, May 10, 2016 at 6:31 PM, Vince Refiti <vinref(a)gmail.com> wrote:
> > Hello
> >
> > I am playing around with Semaphore, and wrote the following:
> >
> > | coll count sem |
> > coll := Array withAll: (1 to: 100).
> > count := 0.
> > sem := Semaphore new.
> > coll do: [ :each |
> > count := count + 1.
> > (count >= 5)
> > ifTrue: [
> > Transcript show: 'waiting...'; cr.
> > sem wait ].
> >
> > [ [ 2 seconds asDelay wait.
> > Transcript show: each printString, ' ', count printString; cr ]
> > ensure: [
> > count := count -1.
> > sem signal ] ] fork ]
> >
> > The output is:
>
> [snipped]
>
> > I was expecting 'waiting...' to alternate with the 'each-count' lines.
> Also
> > the entire statement paused for 2 seconds, spat out some lines, then
> waited
> > a little longer, and then finished.
> >
> > Can someone please explain this pattern?
> >
> > Thanks, Vince
>
> Hi Vince,
>
> General things to be aware of...
> * Transcript is not perturbing your result.
> * Playground code is executed in the context of the main UI-process.
> Thus...
> * An infinite loop will lock the UI.
> * A sem wait will lock the UI.
> * Processes at the same priority are scheduled cooperatively.
> * Processes at different priority are pre-emptively scheduled.
>
> I refactored your example to better highlight program flow...
>
> | coll count sem |
> Transcript clear.
> coll := Array withAll: (1 to: 99).
> count := 0.
> sem := Semaphore new.
> coll do:
> [ :each |
> count := count + 1.
> Transcript crShow: each printString; tab; tab; show: count printString,
> '+'.
> (count >= 5) ifTrue:
> [ sem isSignaled
> ifTrue: [ Transcript tab; show: ' nowait'.
> sem wait ]
> ifFalse: [ Transcript tab; show: ' wait'.
> sem wait.
> Transcript crShow: each printString; tab;
> tab; show: count printString; tab; show: ' postwait, excessSignals ' ,
> sem excessSignals printString. ]
> ].
>
> [ Transcript crShow: ' ', each printString; tab; tab; show: count
> printString; tab; show: ' delay'.
> 2 seconds asDelay wait.
> count := count -1.
> Transcript crShow: ' ', each printString; tab ; tab; show: count
> printString, '-'; tab; show: ' signal'.
> sem signal.
> ] fork.
> ]
>
> You will need to add...
> Semaphore>>excessSignals
> ^excessSignals
>
>
> For counts 1, 2, 3 & 4, forked processes -1 to -4 are queued to run,
> but don't run until the UI-process suspended by the wait at each=5,
> count=5, which is why the "waiting..." tag appears first.
>
> When the UI-process waits, processes -1 to -4 run in turn and
> immediately delay for two seconds. After this, they queued to run.
> Process-1 signals the UI-process to be queued to run. But processes
> -2 to -4 run first, signalling sem an extra three times.
>
> When the UI-process resumes, each=5, count=1 and sem has three
> excessSignals. Completing the do: adds process -5 to the run queue.
> Then counts 2, 3, & 4 queues processes -6, -7 & -8 to run. Counts 5,
> 6 & 7 consume the excessSignals without suspending, queing processes
> -9, -10 & -11 to run.
>
> At count=8, the UI-process suspends at the wait, and process -5 runs.
> This signals the UI-process to be queued to run. Processes -6 to -11
> run, signalling sem an extra six times.
>
> When the UI-process resumes, each=12, count=1 and sem has six
> excessSignals. Completing the do: adds process -12 to the run queue.
> Then counts 2, 3, & 4 queues processes -13, -14 & -15 to run. Counts
> 5, 6, 7, 8, 9, 10 consume the excessSignals without suspending, queing
> processes -16, -17, -18, -19, -20, -21 to run.
>
> At count=11, the UI-process suspends at the wait, and process -12
> runs. This signals the UI-process to be queued to run. Processes -13
> to -21 run, signalling sem an extra nine times.
>
> ecetera...
>
> btw, The delay doesn't make much difference to how the forked
> processes interact with the main UI-process, since all forked
> processes execute before the UI-process resumed. It just interleaves
> the delay/signal tags rather than grouping them.
>
>
> 1 1+
> 2 2+
> 3 3+
> 4 4+
> 5 5+ wait
> 1 5 delay
> 2 5 delay
> 3 5 delay
> 4 5 delay
> 1 4- signal
> 2 3- signal
> 3 2- signal
> 4 1- signal
> 5 1 postwait, excessSignals 3
> 6 2+
> 7 3+
> 8 4+
> 9 5+ nowait
> 10 6+ nowait
> 11 7+ nowait
> 12 8+ wait
> 5 8 delay
> 6 8 delay
> 7 8 delay
> 8 8 delay
> 9 8 delay
> 10 8 delay
> 11 8 delay
> 5 7- signal
> 6 6- signal
> 7 5- signal
> 8 4- signal
> 9 3- signal
> 10 2- signal
> 11 1- signal
> 12 1 postwait, excessSignals 6
> 13 2+
> 14 3+
> 15 4+
> 16 5+ nowait
> 17 6+ nowait
> 18 7+ nowait
> 19 8+ nowait
> 20 9+ nowait
> 21 10+ nowait
> 22 11+ wait
> 12 11 delay
> 13 11 delay
> 14 11 delay
> 15 11 delay
> 16 11 delay
> 17 11 delay
> 18 11 delay
> 19 11 delay
> 20 11 delay
> 21 11 delay
> 12 10- signal
> 13 9- signal
> 14 8- signal
> 15 7- signal
> 16 6- signal
> 17 5- signal
> 18 4- signal
> 19 3- signal
> 20 2- signal
> 21 1- signal
> 22 1 postwait, excessSignals 9
> 23 2+
> 24 3+
> 25 4+
> 26 5+ nowait
> 27 6+ nowait
> 28 7+ nowait
> 29 8+ nowait
> 30 9+ nowait
> 31 10+ nowait
> 32 11+ nowait
> 33 12+ nowait
> 34 13+ nowait
> 35 14+ wait
> 22 14 delay
> 23 14 delay
> 24 14 delay
> 25 14 delay
> 26 14 delay
> 27 14 delay
> 28 14 delay
> 29 14 delay
> 30 14 delay
> 31 14 delay
> 32 14 delay
> 33 14 delay
> 34 14 delay
> 22 13- signal
> 23 12- signal
> 24 11- signal
> 25 10- signal
> 26 9- signal
> 27 8- signal
> 28 7- signal
> 29 6- signal
> 30 5- signal
> 31 4- signal
> 32 3- signal
> 33 2- signal
> 34 1- signal
> 35 1 postwait, excessSignals 12
> 36 2+
> 37 3+
> 38 4+
> 39 5+ nowait
> 40 6+ nowait
> 41 7+ nowait
> 42 8+ nowait
> 43 9+ nowait
> 44 10+ nowait
> 45 11+ nowait
> 46 12+ nowait
> 47 13+ nowait
> 48 14+ nowait
> 49 15+ nowait
> 50 16+ nowait
> 51 17+ wait
> 35 17 delay
> 36 17 delay
> 37 17 delay
> 38 17 delay
> 39 17 delay
> 40 17 delay
> 41 17 delay
> 42 17 delay
> 43 17 delay
> 44 17 delay
> 45 17 delay
> 46 17 delay
> 47 17 delay
> 48 17 delay
> 49 17 delay
> 50 17 delay
> 35 16- signal
> 36 15- signal
> 37 14- signal
> 38 13- signal
> 39 12- signal
> 40 11- signal
> 41 10- signal
> 42 9- signal
> 43 8- signal
> 44 7- signal
> 45 6- signal
> 46 5- signal
> 47 4- signal
> 48 3- signal
> 49 2- signal
> 50 1- signal
> 51 1 postwait, excessSignals 15
> 52 2+
> 53 3+
> 54 4+
> 55 5+ nowait
> 56 6+ nowait
> 57 7+ nowait
> 58 8+ nowait
> 59 9+ nowait
> 60 10+ nowait
> 61 11+ nowait
> 62 12+ nowait
> 63 13+ nowait
> 64 14+ nowait
> 65 15+ nowait
> 66 16+ nowait
> 67 17+ nowait
> 68 18+ nowait
> 69 19+ nowait
> 70 20+ wait
> 51 20 delay
> 52 20 delay
> 53 20 delay
> 54 20 delay
> 55 20 delay
> 56 20 delay
> 57 20 delay
> 58 20 delay
> 59 20 delay
> 60 20 delay
> 61 20 delay
> 62 20 delay
> 63 20 delay
> 64 20 delay
> 65 20 delay
> 66 20 delay
> 67 20 delay
> 68 20 delay
> 69 20 delay
> 51 19- signal
> 52 18- signal
> 53 17- signal
> 54 16- signal
> 55 15- signal
> 56 14- signal
> 57 13- signal
> 58 12- signal
> 59 11- signal
> 60 10- signal
> 61 9- signal
> 62 8- signal
> 63 7- signal
> 64 6- signal
> 65 5- signal
> 66 4- signal
> 67 3- signal
> 68 2- signal
> 69 1- signal
> 70 1 postwait, excessSignals 18
> 71 2+
> 72 3+
> 73 4+
> 74 5+ nowait
> 75 6+ nowait
> 76 7+ nowait
> 77 8+ nowait
> 78 9+ nowait
> 79 10+ nowait
> 80 11+ nowait
> 81 12+ nowait
> 82 13+ nowait
> 83 14+ nowait
> 84 15+ nowait
> 85 16+ nowait
> 86 17+ nowait
> 87 18+ nowait
> 88 19+ nowait
> 89 20+ nowait
> 90 21+ nowait
> 91 22+ nowait
> 92 23+ wait
> 70 23 delay
> 71 23 delay
> 72 23 delay
> 73 23 delay
> 74 23 delay
> 75 23 delay
> 76 23 delay
> 77 23 delay
> 78 23 delay
> 79 23 delay
> 80 23 delay
> 81 23 delay
> 82 23 delay
> 83 23 delay
> 84 23 delay
> 85 23 delay
> 86 23 delay
> 87 23 delay
> 88 23 delay
> 89 23 delay
> 90 23 delay
> 91 23 delay
> 70 22- signal
> 71 21- signal
> 72 20- signal
> 73 19- signal
> 74 18- signal
> 75 17- signal
> 76 16- signal
> 77 15- signal
> 78 14- signal
> 79 13- signal
> 80 12- signal
> 81 11- signal
> 82 10- signal
> 83 9- signal
> 84 8- signal
> 85 7- signal
> 86 6- signal
> 87 5- signal
> 88 4- signal
> 89 3- signal
> 90 2- signal
> 91 1- signal
> 92 1 postwait, excessSignals 21
> 93 2+
> 94 3+
> 95 4+
> 96 5+ nowait
> 97 6+ nowait
> 98 7+ nowait
> 99 8+ nowait
> 92 8 delay
> 93 8 delay
> 94 8 delay
> 95 8 delay
> 96 8 delay
> 97 8 delay
> 98 8 delay
> 99 8 delay
> 92 7- signal
> 93 6- signal
> 94 5- signal
> 95 4- signal
> 96 3- signal
> 97 2- signal
> 98 1- signal
> 99 0- signal
>
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 11 May 2016 00:51:12 +0800
> From: Ben Coman <btc(a)openinworld.com>
> To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
> Subject: Re: [Pharo-users] (no subject)
> Message-ID:
> <CAProBT=Xvj67KV6CG+tb6qa=
> jATTBuX+bgc3AnWMAz9A19x_HQ(a)mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> On Tue, May 10, 2016 at 8:52 PM, Franklin Mike
> <mike1corporation(a)gmail.com> wrote:
> > Hi !
> >
> > I'm new on pharo and I realy like its vision. To learn more about the
> system
> > I decide to write a package that handle Webcam. The package should be
> able
> > to :
> >
> > - start webcam
> > - take photo
> > - record a video.
> >
> > The wonderfull thing is that I don't know where to start, Every advice is
> > welcome.
>
> I guess you will need to interface to some library, so for Pharo 5
> have a play with its new UFFI interface.
> A quick google around shows opencv to be a common base for FFI...
>
> http://opencvlover.blogspot.com.au/2011/07/accesing-camera-using-opencv.html
>
> but I also found this...
> http://itseez.com/tags/openvx/
> Note that NativeBoost was an FFI implementation for Pharo 4.
>
> cheers -ben
>
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 10 May 2016 22:55:42 +0200
> From: "phil(a)highoctane.be" <phil(a)highoctane.be>
> To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
> Subject: Re: [Pharo-users] (no subject)
> Message-ID:
> <
> CAMynPtw0Yy+zP5Lh2VwXPCYQvM5h+RYBBchHj-s-HciWPkwEFA(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> There is a camera plugin in the source tree of the VM.
>
> pharo-vm/platforms/win32/plugins/CameraPlugin
>
> You can copy the dll in the Pharo directory and load the dll with:
>
> NativeBoost forCurrentPlatform loadModule: 'CameraPlugin.dll'
>
> Anyone having the FFI calls?
>
> Maybe Phratch has it built in.
>
> Phil
>
May 11, 2016
SPLASH 2016: Call for Sponsorships
by Tijs van der Storm
The ACM SIGPLAN conference on Systems, Programming, Languages and
Applications: Software for Humanity (SPLASH) embraces all aspects of
software construction and delivery to make it the premier conference at the
intersection of programming, languages, and software engineering. SPLASH
2016 will take place from Sunday, October 30 to Friday, November 4, 2016 in
Amsterdam, The Netherlands.
Web version of this call for sponsorships:
http://2016.splashcon.org/attending/support-program
SPLASH is where the best of the best in software innovation, programming
and programming languages convene, learn from and inspire each other, and
share their passion for software. Supporting SPLASH is an opportunity to
put your corporate name in front of this community — a superb investment
for your organization.
# Sponsorship Packages
## Diamond: $US 15 000
Benefits:
- Recognition as a supporter in print and on the web. Recognized as a
Diamond supporter on registration brochures and conference program
- Two company-provided items placed in the conference tote bag
- Official exclusive support for your choice of (subject to availability):
Doctoral Symposium, Poster Session, Keynotes, or support for 8 Student
Volunteers named for your organization
- Attendance (for two) at an invitation-only reception by the SPLASH
General Chair
- Choice of: two Full conference registrations; or two complimentary main
conference registrations plus two complimentary one-day pass registrations
## Gold: $US 10 000
Benefits:
- Recognition as a supporter in print and on the web. Recognized as a Gold
supporter on registration brochures and conference program
- Two company-provided items placed in the conference tote bag
- Official support for your choice of (subject to availability): Doctoral
Symposium, Poster Session, Keynotes, or support for 6 Student Volunteers
named for your organization
- Attendance (for two) at an invitation-only reception by the SPLASH
General Chair
- Choice of: one Full conference registration plus one complimentary main
conference registration; or two complimentary main conference registrations
plus one complimentary one-day pass registration
## Silver: $US 5000
Benefits:
- Recognition as a supporter in print and on the web. Recognized as a
Silver supporter on registration brochures and conference program
- One company-provided item placed in the conference tote bag
- Official support for your choice of: four Student Volunteers named for
your organization; or the Keynotes (non-exclusive support)
- Attendance (for two) at an invitation-only reception by the SPLASH
General Chair
- Your choice of: one Full conference registration; or one complimentary
main conference registration plus one complimentary one-day pass
registration; or three complimentary one-day pass registrations
## Bronze $US 3000
- Recognition as a supporter in print and on the web. Recognized as a
Bronze supporter on registration brochures and conference program
- One company-provided one-page insert placed in conference tote bag
- Official support for two Student Volunteers named for your organization
- Attendance (for one) at an invitation-only reception by the SPLASH
General Chair
- Your choice of: one complimentary main conference registration; or two
complimentary one-day pass registrations
# Why sponsor SPLASH?
SPLASH values innovation, collaboration, and diversity. For many software
researchers, academics, students, educators, and practitioners, SPLASH is
the most important conference of the year. It is a place to:
- improve skills and productivity, independent of any particular product or
vendor;
- gain a global perspective connecting with world experts; and
- discover and explore new trends and innovations in leading edge research
and practice.
Becoming a SPLASH corporate supporter demonstrates your leadership and
commitment to the community. It is an opportunity to:
- carry your message to community leaders;
- associate your brand with world-class research and development;
- position your company as a leader in the field; and
- prepare for the future.
Your corporate name and logo will be in front of the entire community
throughout the conference. For the same contribution you also receive
either complimentary or discounted SPLASH registrations for use by your
organization. You will also have the opportunity to participate in
invitation-only events that will provide you with direct, one-on-one
interactions with some key members of the SPLASH community.
Thank you for your time! Please do not hesitate to contact us at
support(a)splashcon.org. We look forward to helping you make the most of your
investment in SPLASH.
Jurgen Vinju
SPLASH 2016 Sponsorship Chair
Eelco Visser
SPLASH 2016 General Chair
May 10, 2016
Re: [Pharo-users] (no subject)
by philï¼ highoctane.be
There is a camera plugin in the source tree of the VM.
pharo-vm/platforms/win32/plugins/CameraPlugin
You can copy the dll in the Pharo directory and load the dll with:
NativeBoost forCurrentPlatform loadModule: 'CameraPlugin.dll'
Anyone having the FFI calls?
Maybe Phratch has it built in.
Phil
May 10, 2016
Re: [Pharo-users] (no subject)
by Ben Coman
On Tue, May 10, 2016 at 8:52 PM, Franklin Mike
<mike1corporation(a)gmail.com> wrote:
> Hi !
>
> I'm new on pharo and I realy like its vision. To learn more about the system
> I decide to write a package that handle Webcam. The package should be able
> to :
>
> - start webcam
> - take photo
> - record a video.
>
> The wonderfull thing is that I don't know where to start, Every advice is
> welcome.
I guess you will need to interface to some library, so for Pharo 5
have a play with its new UFFI interface.
A quick google around shows opencv to be a common base for FFI...
http://opencvlover.blogspot.com.au/2011/07/accesing-camera-using-opencv.html
but I also found this...
http://itseez.com/tags/openvx/
Note that NativeBoost was an FFI implementation for Pharo 4.
cheers -ben
May 10, 2016
Re: [Pharo-users] Semaphore wait and signal
by Ben Coman
On Tue, May 10, 2016 at 6:31 PM, Vince Refiti <vinref(a)gmail.com> wrote:
> Hello
>
> I am playing around with Semaphore, and wrote the following:
>
> | coll count sem |
> coll := Array withAll: (1 to: 100).
> count := 0.
> sem := Semaphore new.
> coll do: [ :each |
> count := count + 1.
> (count >= 5)
> ifTrue: [
> Transcript show: 'waiting...'; cr.
> sem wait ].
>
> [ [ 2 seconds asDelay wait.
> Transcript show: each printString, ' ', count printString; cr ]
> ensure: [
> count := count -1.
> sem signal ] ] fork ]
>
> The output is:
[snipped]
> I was expecting 'waiting...' to alternate with the 'each-count' lines. Also
> the entire statement paused for 2 seconds, spat out some lines, then waited
> a little longer, and then finished.
>
> Can someone please explain this pattern?
>
> Thanks, Vince
Hi Vince,
General things to be aware of...
* Transcript is not perturbing your result.
* Playground code is executed in the context of the main UI-process. Thus...
* An infinite loop will lock the UI.
* A sem wait will lock the UI.
* Processes at the same priority are scheduled cooperatively.
* Processes at different priority are pre-emptively scheduled.
I refactored your example to better highlight program flow...
| coll count sem |
Transcript clear.
coll := Array withAll: (1 to: 99).
count := 0.
sem := Semaphore new.
coll do:
[ :each |
count := count + 1.
Transcript crShow: each printString; tab; tab; show: count printString, '+'.
(count >= 5) ifTrue:
[ sem isSignaled
ifTrue: [ Transcript tab; show: ' nowait'.
sem wait ]
ifFalse: [ Transcript tab; show: ' wait'.
sem wait.
Transcript crShow: each printString; tab;
tab; show: count printString; tab; show: ' postwait, excessSignals ' ,
sem excessSignals printString. ]
].
[ Transcript crShow: ' ', each printString; tab; tab; show: count
printString; tab; show: ' delay'.
2 seconds asDelay wait.
count := count -1.
Transcript crShow: ' ', each printString; tab ; tab; show: count
printString, '-'; tab; show: ' signal'.
sem signal.
] fork.
]
You will need to add...
Semaphore>>excessSignals
^excessSignals
For counts 1, 2, 3 & 4, forked processes -1 to -4 are queued to run,
but don't run until the UI-process suspended by the wait at each=5,
count=5, which is why the "waiting..." tag appears first.
When the UI-process waits, processes -1 to -4 run in turn and
immediately delay for two seconds. After this, they queued to run.
Process-1 signals the UI-process to be queued to run. But processes
-2 to -4 run first, signalling sem an extra three times.
When the UI-process resumes, each=5, count=1 and sem has three
excessSignals. Completing the do: adds process -5 to the run queue.
Then counts 2, 3, & 4 queues processes -6, -7 & -8 to run. Counts 5,
6 & 7 consume the excessSignals without suspending, queing processes
-9, -10 & -11 to run.
At count=8, the UI-process suspends at the wait, and process -5 runs.
This signals the UI-process to be queued to run. Processes -6 to -11
run, signalling sem an extra six times.
When the UI-process resumes, each=12, count=1 and sem has six
excessSignals. Completing the do: adds process -12 to the run queue.
Then counts 2, 3, & 4 queues processes -13, -14 & -15 to run. Counts
5, 6, 7, 8, 9, 10 consume the excessSignals without suspending, queing
processes -16, -17, -18, -19, -20, -21 to run.
At count=11, the UI-process suspends at the wait, and process -12
runs. This signals the UI-process to be queued to run. Processes -13
to -21 run, signalling sem an extra nine times.
ecetera...
btw, The delay doesn't make much difference to how the forked
processes interact with the main UI-process, since all forked
processes execute before the UI-process resumed. It just interleaves
the delay/signal tags rather than grouping them.
1 1+
2 2+
3 3+
4 4+
5 5+ wait
1 5 delay
2 5 delay
3 5 delay
4 5 delay
1 4- signal
2 3- signal
3 2- signal
4 1- signal
5 1 postwait, excessSignals 3
6 2+
7 3+
8 4+
9 5+ nowait
10 6+ nowait
11 7+ nowait
12 8+ wait
5 8 delay
6 8 delay
7 8 delay
8 8 delay
9 8 delay
10 8 delay
11 8 delay
5 7- signal
6 6- signal
7 5- signal
8 4- signal
9 3- signal
10 2- signal
11 1- signal
12 1 postwait, excessSignals 6
13 2+
14 3+
15 4+
16 5+ nowait
17 6+ nowait
18 7+ nowait
19 8+ nowait
20 9+ nowait
21 10+ nowait
22 11+ wait
12 11 delay
13 11 delay
14 11 delay
15 11 delay
16 11 delay
17 11 delay
18 11 delay
19 11 delay
20 11 delay
21 11 delay
12 10- signal
13 9- signal
14 8- signal
15 7- signal
16 6- signal
17 5- signal
18 4- signal
19 3- signal
20 2- signal
21 1- signal
22 1 postwait, excessSignals 9
23 2+
24 3+
25 4+
26 5+ nowait
27 6+ nowait
28 7+ nowait
29 8+ nowait
30 9+ nowait
31 10+ nowait
32 11+ nowait
33 12+ nowait
34 13+ nowait
35 14+ wait
22 14 delay
23 14 delay
24 14 delay
25 14 delay
26 14 delay
27 14 delay
28 14 delay
29 14 delay
30 14 delay
31 14 delay
32 14 delay
33 14 delay
34 14 delay
22 13- signal
23 12- signal
24 11- signal
25 10- signal
26 9- signal
27 8- signal
28 7- signal
29 6- signal
30 5- signal
31 4- signal
32 3- signal
33 2- signal
34 1- signal
35 1 postwait, excessSignals 12
36 2+
37 3+
38 4+
39 5+ nowait
40 6+ nowait
41 7+ nowait
42 8+ nowait
43 9+ nowait
44 10+ nowait
45 11+ nowait
46 12+ nowait
47 13+ nowait
48 14+ nowait
49 15+ nowait
50 16+ nowait
51 17+ wait
35 17 delay
36 17 delay
37 17 delay
38 17 delay
39 17 delay
40 17 delay
41 17 delay
42 17 delay
43 17 delay
44 17 delay
45 17 delay
46 17 delay
47 17 delay
48 17 delay
49 17 delay
50 17 delay
35 16- signal
36 15- signal
37 14- signal
38 13- signal
39 12- signal
40 11- signal
41 10- signal
42 9- signal
43 8- signal
44 7- signal
45 6- signal
46 5- signal
47 4- signal
48 3- signal
49 2- signal
50 1- signal
51 1 postwait, excessSignals 15
52 2+
53 3+
54 4+
55 5+ nowait
56 6+ nowait
57 7+ nowait
58 8+ nowait
59 9+ nowait
60 10+ nowait
61 11+ nowait
62 12+ nowait
63 13+ nowait
64 14+ nowait
65 15+ nowait
66 16+ nowait
67 17+ nowait
68 18+ nowait
69 19+ nowait
70 20+ wait
51 20 delay
52 20 delay
53 20 delay
54 20 delay
55 20 delay
56 20 delay
57 20 delay
58 20 delay
59 20 delay
60 20 delay
61 20 delay
62 20 delay
63 20 delay
64 20 delay
65 20 delay
66 20 delay
67 20 delay
68 20 delay
69 20 delay
51 19- signal
52 18- signal
53 17- signal
54 16- signal
55 15- signal
56 14- signal
57 13- signal
58 12- signal
59 11- signal
60 10- signal
61 9- signal
62 8- signal
63 7- signal
64 6- signal
65 5- signal
66 4- signal
67 3- signal
68 2- signal
69 1- signal
70 1 postwait, excessSignals 18
71 2+
72 3+
73 4+
74 5+ nowait
75 6+ nowait
76 7+ nowait
77 8+ nowait
78 9+ nowait
79 10+ nowait
80 11+ nowait
81 12+ nowait
82 13+ nowait
83 14+ nowait
84 15+ nowait
85 16+ nowait
86 17+ nowait
87 18+ nowait
88 19+ nowait
89 20+ nowait
90 21+ nowait
91 22+ nowait
92 23+ wait
70 23 delay
71 23 delay
72 23 delay
73 23 delay
74 23 delay
75 23 delay
76 23 delay
77 23 delay
78 23 delay
79 23 delay
80 23 delay
81 23 delay
82 23 delay
83 23 delay
84 23 delay
85 23 delay
86 23 delay
87 23 delay
88 23 delay
89 23 delay
90 23 delay
91 23 delay
70 22- signal
71 21- signal
72 20- signal
73 19- signal
74 18- signal
75 17- signal
76 16- signal
77 15- signal
78 14- signal
79 13- signal
80 12- signal
81 11- signal
82 10- signal
83 9- signal
84 8- signal
85 7- signal
86 6- signal
87 5- signal
88 4- signal
89 3- signal
90 2- signal
91 1- signal
92 1 postwait, excessSignals 21
93 2+
94 3+
95 4+
96 5+ nowait
97 6+ nowait
98 7+ nowait
99 8+ nowait
92 8 delay
93 8 delay
94 8 delay
95 8 delay
96 8 delay
97 8 delay
98 8 delay
99 8 delay
92 7- signal
93 6- signal
94 5- signal
95 4- signal
96 3- signal
97 2- signal
98 1- signal
99 0- signal
May 10, 2016
Re: [Pharo-users] Semaphore wait and signal
by philï¼ highoctane.be
Transcript output logic is wicked, flush or not. Especially if you Halt now.
Check for stepGlobal senders and implmenters and see it in all its glory
with flags and all.
You can then understand why things are weird.
Some World doOneCycle peppered around may confuse things a bit more.
Use a log file and tail -f it if you are on OSX or Linux.
It will at least be in the order you issue things.
Phil
On Tue, May 10, 2016 at 1:15 PM, Johan Fabry <jfabry(a)dcc.uchile.cl> wrote:
> Hi Vince,
>
> some of your problem may be in the Transcript buffering some of its
> output. It is best to add a ; flush to the end of all your printing, e.g.
> Transcript show: 'waiting...'; cr ; flush.
>
> HTH
>
> On May 10, 2016, at 07:31, Vince Refiti <vinref(a)gmail.com> wrote:
>
> Hello
>
> I am playing around with Semaphore, and wrote the following:
>
> | coll count sem |
> coll := Array withAll: (1 to: 100).
> count := 0.
> sem := Semaphore new.
> coll do: [ :each |
> count := count + 1.
> (count >= 5)
> ifTrue: [
> Transcript show: 'waiting...'; cr.
> sem wait ].
>
> [ [ 2 seconds asDelay wait.
> Transcript show: each printString, ' ', count printString; cr ]
> ensure: [
> count := count -1.
> sem signal ] ] fork ]
>
> The output is:
>
> waiting...
> 1 End of statement list encountered ->5
> 2 4
> 3 3
> 4 2
> waiting...
> waiting...
> waiting...
> waiting...
> 5 8
> 6 7
> 7 6
> 8 5
> 9 4
> 10 3
> 11 2
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> 12 11
> 13 10
> 14 9
> 15 8
> 16 7
> 17 6
> 18 5
> 19 4
> 20 3
> 21 2
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> 22 14
> 23 13
> 24 12
> 25 11
> 26 10
> 27 9
> 28 8
> 29 7
> 30 6
> 31 5
> 32 4
> 33 3
> 34 2
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> 35 17
> 36 16
> 37 15
> 38 14
> 39 13
> 40 12
> 41 11
> 42 10
> 43 9
> 44 8
> 45 7
> 46 6
> 47 5
> 48 4
> 49 3
> 50 2
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> 51 20
> 52 19
> 53 18
> 54 17
> 55 16
> 56 15
> 57 14
> 58 13
> 59 12
> 60 11
> 61 10
> 62 9
> 63 8
> 64 7
> 65 6
> 66 5
> 67 4
> 68 3
> 69 2
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> 70 23
> waiting...
> 71 23
> 72 22
> 73 21
> 74 20
> 75 19
> 76 18
> 77 17
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> waiting...
> 78 23
> 79 22
> 80 21
> 81 20
> 82 19
> 83 18
> 84 17
> 85 16
> 86 15
> 87 14
> 88 13
> 89 12
> 90 11
> 91 10
> 92 9
> 93 8
> 94 7
> 95 6
> 96 5
> 97 4
> 98 3
> 99 2
> 100 1
>
> I was expecting 'waiting...' to alternate with the 'each-count' lines.
> Also the entire statement paused for 2 seconds, spat out some lines, then
> waited a little longer, and then finished.
>
> Can someone please explain this pattern?
>
> Thanks, Vince
>
>
>
>
> ---> Save our in-boxes! http://emailcharter.org <---
>
> Johan Fabry - http://pleiad.cl/~jfabry
> PLEIAD and RyCh labs - Computer Science Department (DCC) - University
> of Chile
>
>
May 10, 2016
(no subject)
by Franklin Mike
Hi !
I'm new on pharo and I realy like its vision. To learn more about the
system I decide to write a package that handle Webcam. The package should
be able to :
- start webcam
- take photo
- record a video.
The wonderfull thing is that I don't know where to start, Every advice is
welcome.
Thanks!
.
May 10, 2016