<dan2>
I'm pretty sure it can only happen in one place
<dan2>
ok_thread
<|Lupin|>
well
<dan2>
theres a slight possibility it would happen in test_threadfunc at recv
<|Lupin|>
just one stylistic remark
<dan2>
Mailbox.recv
<|Lupin|>
in creat_threads
<|Lupin|>
the final () is probably not usefull
<|Lupin|>
for constructs have type unit
<dan2>
|Lupin|: thats irrelevant
<dan2>
|Lupin|: I need to solve the problem
<|Lupin|>
same remark for handle_events
<dan2>
|Lupin|: its not helping
<|Lupin|>
I know it has nothing to do with your problem, but shorter and clearer code is always easier to debug.
<dan2>
|Lupin|: this is useless
mlh has quit [Client Quit]
<|Lupin|>
in ok_thread, how can you besure that there will be something inthe queue ?
<|Lupin|>
dan2: in ok_thread, how can you besure that there will be something inthe queue ?
<dan2>
|Lupin|: because as soon as the thread ends, it will give handle events a CONNECTION_WAIT
<dan2>
|Lupin|: and if its 0, handle_queue will load a thread before then
<|Lupin|>
From my point of view
<|Lupin|>
your code lacks synchronization mechanisms
<|Lupin|>
Is it on purpose ?
<dan2>
|Lupin|: yes
<|Lupin|>
ow
<|Lupin|>
So you are sure nothing bad can happen because a context switch happening ?
* dan2
kicks ocaml
<dan2>
|Lupin|: because you requested it here
<|Lupin|>
what did I request ?
<dan2>
|Lupin|: now if there is no thread available it should add one in ok_thread
<dan2>
|Lupin|: refresh
<|Lupin|>
hmm I think I'll not be able to help you, sorry.
<dan2>
|Lupin|: I think its being caused by Mailbox.receive
Submarine has joined #ocaml
<|Lupin|>
hi Submarine
<Submarine>
hi
m3ga has joined #ocaml
m3ga has quit [Client Quit]
srv has quit [Read error: 104 (Connection reset by peer)]
srv has joined #ocaml
pango has quit ["Client exiting"]
solarwind has joined #ocaml
Nutssh has joined #ocaml
Nutssh has left #ocaml []
pango has joined #ocaml
det_ has joined #ocaml
Submarine has quit ["Leaving"]
<Demitar>
dan2, while the file certanily is in the public domain claiming you wrote it is bad style. (Rather add "modified by ..." or something equivalent.)
<Demitar>
dan2, and I'm not sure that your implementation of is_empty is safe, _internal_queue can be modified by another thread. And I doubt it is even useful, another thread might receive an object in between you get the result and call receive thus making it block anyway, that's what poll is there for.
|Lupin| has quit ["leaving"]
srid has joined #ocaml
<srid>
i am wondering how ICFP winners were using OCaml! ... when there are python, lisp, haskell ....
<Demitar>
That is one peculiar question... :)
<karryall>
arf
<srid>
Demitar: well, i am newbie to this FP world ... know c,c++,bit of java and python (my favourite)
<srid>
thinking of learning lisp and haskell .. but ocaml is really different ...
<srid>
... from ICFP point of view
<Demitar>
srid, well you question has the implicit assumption that all those other languages are inherently better somehow. :)
<srid>
basically my question is what makes those ICFP participants to prefer OCaml over others .. really confused
gim has joined #ocaml
<Demitar>
srid, there could be a zillion different answers to that, ranging from "it R0xx0rz" to "because I invented it" to "since it's the best language so far". Choose yourself. ;-) Or be more specific. (In general I think they mostly simply like the language. :)
mrvn_ is now known as mrvn
stef_ has quit [Read error: 110 (Connection timed out)]
srid has quit [Read error: 104 (Connection reset by peer)]
stef has joined #ocaml
Godeke has quit [tolkien.freenode.net irc.freenode.net]
Godeke has joined #ocaml
zzorn has joined #ocaml
solarwind has quit ["leaving"]
solarwind has joined #ocaml
zzorn has quit ["........"]
CosmicRay has joined #ocaml
<dan2>
Demitar: ping
zzorn has joined #ocaml
<dan2>
Demitar: there is a problem when trying to Mailbox.recv on mbox per thread
<dan2>
Demitar: the problem is that it tends to get it before the mbox does
<dan2>
Demitar: I think we need a mutex
<dan2>
Demitar: ping
CosmicRay has quit ["Client exiting"]
vezenchio has joined #ocaml
<dan2>
cd
CosmicRay has joined #ocaml
rifleman_maynard has quit ["using sirc version 2.211+KSIRC/1.3.10"]
Submarine has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
lus|wats has joined #ocaml
smimou has joined #ocaml
<dan2>
whats up with Thread.kill not implemented
vezenchio has quit [Read error: 60 (Operation timed out)]
vincenz has quit [Read error: 104 (Connection reset by peer)]
cryptilox has joined #ocaml
mfurr has joined #ocaml
<dan2>
mfurr: ping
<mfurr>
dan2: pong
<dan2>
mfurr: how do I make sure all the threads in my program aren't sleeping
<dan2>
mfurr: thats the problem
<dan2>
mfurr: erm, running rater
<dan2>
they aren't running
<dan2>
how do I send a wake up call to all of them
<mfurr>
well, the same way you would make sure a single threaded program wasn't sleeping I'd imagine
<dan2>
mfurr: everything I try fails
<dan2>
mfurr: its not until I start sending crap over the event system do the threads wake up
<mrvn>
There you have the reason why I don't use threads. You always end up with deadlocks or synchronisation problems.
<Smerdyakov>
That is much less of a problem using CML (or OCaml Event).
smimou has quit ["?"]
vezenchio has joined #ocaml
<dan2>
Smerdyakov: I'm using ocaml event
<dan2>
Smerdyakov: all the threads are always sleeping
<Smerdyakov>
You're not giving much information. I don't think of that as a problem in and of itself.
<dan2>
Smerdyakov: I have to leave, but I will tell you later
<CosmicRay>
smerdy!
<CosmicRay>
haven't seen you in #haskell for awhile
smimou has joined #ocaml
<Smerdyakov>
I'm banned.
<mfurr>
What happened? Did you badmouth Microsoft Cambridge?
<Smerdyakov>
Nope. I raised a stink every time they helped someone cheat on his homework.
<dan2>
nack
<dan2>
back
* dan2
still can't figure out why the threads never start
Smerdyakov has quit ["Client exiting"]
lus|wats has quit [Read error: 110 (Connection timed out)]
<dan2>
mfurr: could you help me figure out why the threads aren't starting
<mfurr>
dan2: I'm kinda busy atm
<dan2>
mfurr: well, I just can't get any of my threads to start
<karryall>
dan2: could it be some kind of scheduling problem ?
<dan2>
karryall: thats what I think is happening
<karryall>
make sure that your code need to allocate some memory
<dan2>
karryall: what do you mean
<karryall>
the global lock can only be released when your code enters the runtime
<dan2>
karryall: it should be allocating stuff
vezenchio has quit ["haibane · renmei"]
<karryall>
if you have a part of your code that never allocates (eg a for loop on a huge array), it will not switch to other threads I think
<mrvn>
karryall: how about select?
<mrvn>
or sleep?
<karryall>
these blocking function release the lock
<karryall>
so there's no problem
<dan2>
ok
<dan2>
that explains a lot
<dan2>
karryall: even with sleep 0?
<karryall>
I guess so
<karryall>
you need to check the code in the unix module
<dan2>
karryall: that seemed to work
<dan2>
looks like I've got a new error
<dan2>
Fatal error: exception Invalid_argument("Thread.kill: not implemented")
<dan2>
karryall: had to run sleep 1
<dan2>
0 didn't work
<karryall>
you could try select [] [] [] 0.
<dan2>
ok
<dan2>
karryall: nah that didn't work either
<dan2>
karryall: does it matter what I allocate?
<karryall>
I don't think so
<dan2>
karryall: so I cna just do let v = 0
<dan2>
?
vezenchio has joined #ocaml
<karryall>
no because that doesn't allocate anything :)
<karryall>
it's just an integer
<dan2>
karryall: ok, v = "foo"
<karryall>
try let v = "foo" ^ "bar"
<dan2>
hmm, whats "^" do?
<karryall>
string concatenation
<dan2>
karryall: that doesn't appear to be working
<karryall>
what's your platform ?
<dan2>
linux x86
<karryall>
there was some issues with linux 2.6 and earlier releases of ocaml
<dan2>
I'm on 3.08.1
<karryall>
hmm, well I don't know
<dan2>
karryall: nothing is working
<dan2>
karryall: sleep did..
<dan2>
karryall: maybe I'll run select for 0.01
<mrvn>
Doesn't the event interface have a blocking call?
<dan2>
mrvn: sync
<dan2>
mrvn: its in the while loop in my threadfunc, (called by Mailbox.send)
<dan2>
mrvn: but its not helping
<karryall>
dan2: is your code somewhere so I could read it ?
Submarine has quit ["Leaving"]
Submarine has joined #ocaml
cryptilox has quit ["leaving"]
stef has quit [Nick collision from services.]
stef_ has joined #ocaml
avlondono is now known as parrot
parrot is now known as avlondono
monochrom has joined #ocaml
vincenz has joined #ocaml
mfurr has quit ["Client exiting"]
lus|wats has joined #ocaml
srv has quit [Read error: 104 (Connection reset by peer)]
<Demitar>
dan2, although I'm really not sure why it's bad that the messages short-circuit the Mailbox. It could at most affect the ordering, which really is unspecified anyway, unless you use a 1-1 thread communication.