Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
a2ab17ed
Commit
a2ab17ed
authored
Apr 30, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'unstable' of github.com:Neverlord/libcppa into unstable
parents
7cdc837f
70aa8807
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
80 deletions
+82
-80
.gitignore
.gitignore
+46
-45
benchmarks/PingPong.scala
benchmarks/PingPong.scala
+18
-24
benchmarks/distributed.erl
benchmarks/distributed.erl
+14
-7
benchmarks/mk_scala.sh
benchmarks/mk_scala.sh
+4
-4
No files found.
.gitignore
View file @
a2ab17ed
html/
*.beam
.DS_Store
*.class
*.o
*.dylib
test
*.png
*.dat
*.dat
*.dump
*.dylib
*.ii
*.ii
*.s
*.tmp
*.la
*.la
*.lo
*.lo
*.dump
*.o
*.beam
*.png
*.class
*.s
benchmarks/mailbox_performance
*.tmp
benchmarks/actor_creation
.DS_Store
benchmarks/mixed_case
benchmarks/matching
theron_mailbox_performance
.libs/
.deps/
.deps/
libcppa.pc
.libs/
4threads
8threads
INSTALL
Makefile
Makefile.in
Makefile.in
a.out*
aclocal.m4
aclocal.m4
autom4te.cache/
autom4te.cache/
benchmarks/actor_creation
benchmarks/distributed
benchmarks/mailbox_performance
benchmarks/matching
benchmarks/mixed_case
blob/cppatest
callgrind.out*
config.*
configure
cppa.creator.user
depcomp
examples/announce_example_1
examples/announce_example_2
examples/announce_example_3
examples/announce_example_4
examples/announce_example_5
examples/dancing_kirby
examples/dining_philosophers
examples/hello_world_example
examples/math_actor_example
gen_server/parallel_send
gen_server/parallel_send
gen_server/sequential_send
gen_server/sequential_send
gen_server/test.dSYM/
gen_server/test.dSYM/
depcomp
html/
install-sh
install-sh
libcppa.Makefile
libcppa.pc
libcppa.so*
libtool
libtool
ltmain.sh
ltmain.sh
missing
unit_testing/Makefile.in
unit_testing/unit_tests
unit_testing/.deps/
config.*
configure
INSTALL
m4/libtool.m4
m4/libtool.m4
m4/lt*.m4
m4/lt*.m4
a.out*
missing
queue_test
queue_test
cppa.creator.user
test
8threads
theron_mailbox_performance
4threads
unit_testing/.deps/
libcppa.Makefile
unit_testing/Makefile
unit_testing/Makefile.in
unit_testing/unit_tests
variadic_templates_test
variadic_templates_test
variadic_templates_test.dSYM/
variadic_templates_test.dSYM/
Makefile
unit_testing/Makefile
libcppa.so*
blob/cppatest
callgrind.out*
examples/announce_example_1
examples/announce_example_2
examples/announce_example_3
examples/announce_example_4
examples/announce_example_5
examples/hello_world_example
examples/math_actor_example
examples/dining_philosophers
examples/dancing_kirby
benchmarks/PingPong.scala
View file @
a2ab17ed
import
scala.actors.Actor
import
scala.actors.Actor
import
scala.actors.Actor._
import
scala.actors.Actor._
import
akka.actor.Actor.actorOf
import
akka.actor.Actor.remote
import
Console.println
import
Console.println
case
object
KickOff
case
object
KickOff
...
@@ -14,41 +12,36 @@ object global {
...
@@ -14,41 +12,36 @@ object global {
class
PingActor
(
num
:
Int
,
pong
:
akka.actor.ActorRef
)
extends
akka
.
actor
.
Actor
{
class
PingActor
(
num
:
Int
,
pong
:
akka.actor.ActorRef
)
extends
akka
.
actor
.
Actor
{
def
receive
=
{
def
receive
=
{
case
Pong
(
value
)
if
value
==
num
=>
{
case
Pong
(
`num`
)
=>
{
//println("Received final pong")
//println("Received final pong")
global
.
latch
.
countDown
global
.
latch
.
countDown
self
.
exit
context
.
stop
(
self
)
}
case
Pong
(
value
:
Int
)
=>
{
//println("Received Pong(" + value + ")")
self
.
reply
(
Ping
(
value
))
}
case
KickOff
=>
{
pong
!
Ping
(
0
)
}
}
case
Pong
(
value
)
=>
sender
!
Ping
(
value
+
1
)
case
KickOff
=>
pong
!
Ping
(
0
)
}
}
}
}
class
PongActor
extends
akka
.
actor
.
Actor
{
class
PongActor
extends
akka
.
actor
.
Actor
{
def
receive
=
{
def
receive
=
{
case
Ping
(
value
:
Int
)
=>
{
case
Ping
(
value
)
=>
sender
!
Pong
(
value
)
//println("Received Ping(" + value + ")")
self
.
reply
(
Pong
(
value
+
1
))
}
}
}
}
}
object
pingApp
{
object
pingApp
{
def
main
(
args
:
Array
[
String
])
=
{
def
main
(
args
:
Array
[
String
])
=
{
if
(
args
.
size
!=
3
)
{
if
(
args
.
size
!=
3
)
{
println
(
"usage: pingApp (host) (port)"
)
println
(
"usage: pingApp (host) (port)
(num pings)
"
)
println
(
"
(connects to pong-service of (host) on given
port)"
)
println
(
"
connects to pong-service@(host):(
port)"
)
System
.
exit
(
1
)
System
.
exit
(
1
)
}
}
val
pong
=
remote
.
actorFor
(
"pong-service"
,
args
(
0
),
args
(
1
).
toInt
)
val
host
=
args
(
0
)
val
myPing
=
actorOf
(
new
PingActor
(
args
(
2
).
toInt
,
pong
)).
start
val
port
=
args
(
1
).
toInt
remote
.
start
(
"localhost"
,
64002
).
register
(
"ping-service"
,
myPing
)
val
numPings
=
args
(
2
).
toInt
myPing
!
KickOff
val
pong
=
remote
.
actorFor
(
"pong-service"
,
host
,
port
)
val
ping
=
system
.
actorOf
(
Props
(
new
PingActor
(
numPings
,
pong
)),
name
=
"ping"
)
remote
.
start
(
"localhost"
,
64002
).
register
(
"ping-service"
,
ping
)
ping
!
KickOff
global
.
latch
.
await
global
.
latch
.
await
remote
.
shutdown
remote
.
shutdown
System
.
exit
(
0
)
System
.
exit
(
0
)
...
@@ -59,11 +52,12 @@ object pongApp {
...
@@ -59,11 +52,12 @@ object pongApp {
def
main
(
args
:
Array
[
String
])
=
{
def
main
(
args
:
Array
[
String
])
=
{
if
(
args
.
size
!=
1
)
{
if
(
args
.
size
!=
1
)
{
println
(
"usage: pongApp (port)"
)
println
(
"usage: pongApp (port)"
)
println
(
"
(binds pong-service to given port)
"
)
println
(
"
binds pong-service to given port
"
)
System
.
exit
(
1
)
System
.
exit
(
1
)
}
}
val
myPong
=
actorOf
(
new
PongActor
).
start
remote
.
start
(
"localhost"
,
args
(
0
).
toInt
)
remote
.
start
(
"localhost"
,
args
(
0
).
toInt
)
.
register
(
"pong-service"
,
myPong
)
.
register
(
"pong-service"
,
actorOf
(
new
PongActor
).
start
)
}
}
}
}
benchmarks/distributed.erl
View file @
a2ab17ed
...
@@ -7,24 +7,31 @@ ping_loop(Parent, Pong) ->
...
@@ -7,24 +7,31 @@ ping_loop(Parent, Pong) ->
{
pong
,
X
}
->
{
pong
,
X
}
->
Pong
!
{
ping
,
self
(),
X
-
1
},
Pong
!
{
ping
,
self
(),
X
-
1
},
ping_loop
(
Parent
,
Pong
);
ping_loop
(
Parent
,
Pong
);
{
kickoff
,
Value
}
->
{
kickoff
,
X
}
->
Pong
!
{
ping
,
self
(),
Value
},
Pong
!
{
ping
,
self
(),
X
},
ping_loop
(
Parent
,
Pong
)
ping_loop
(
Parent
,
Pong
)
end
.
end
.
server_loop
(
Pongs
)
->
server_loop
(
Pongs
)
->
receive
receive
{
ping
,
Pid
,
Value
}
->
Pid
!
{
pong
,
Value
},
server_loop
(
Pongs
);
{
ping
,
Pid
,
X
}
->
Pid
!
{
pong
,
X
},
server_loop
(
Pongs
);
{
add_pong
,
Pid
,
Node
}
->
{
add_pong
,
Pid
,
Node
}
->
case
lists
:
any
(
fun
({
N
,
_})
->
N
==
Node
end
,
Pongs
)
of
case
lists
:
any
(
fun
({
N
,
_})
->
N
==
Node
end
,
Pongs
)
of
true
->
true
->
Pid
!
{
ok
},
Pid
!
{
ok
,
cached
},
server_loop
(
Pongs
);
server_loop
(
Pongs
);
false
->
false
->
case
rpc
:
call
(
Node
,
erlang
,
whereis
,
[
pong
])
of
case
rpc
:
call
(
Node
,
erlang
,
whereis
,
[
pong
])
of
{
badrpc
,
Reason
}
->
Pid
!
{
error
,
Reason
};
{
badrpc
,
Reason
}
->
Pid
!
{
error
,
Reason
},
server_loop
(
Pongs
);
undefined
->
Pid
!
{
error
,
'pong is undefined'
},
server_loop
(
Pongs
);
Pong
->
Pong
->
Pid
!
{
ok
},
Pid
!
{
ok
,
added
},
server_loop
(
Pongs
++
[{
Node
,
Pong
}])
server_loop
(
Pongs
++
[{
Node
,
Pong
}])
end
end
end
;
end
;
...
@@ -46,7 +53,7 @@ add_pong_fun(Pong, Node, [Node|T]) -> add_pong_fun(Pong, Node, T);
...
@@ -46,7 +53,7 @@ add_pong_fun(Pong, Node, [Node|T]) -> add_pong_fun(Pong, Node, T);
add_pong_fun
(
Pong
,
Node
,
[
H
|
T
])
->
add_pong_fun
(
Pong
,
Node
,
[
H
|
T
])
->
Pong
!
{
add_pong
,
self
(),
H
},
Pong
!
{
add_pong
,
self
(),
H
},
receive
receive
{
ok
}
->
add_pong_fun
(
Pong
,
Node
,
T
);
{
ok
,
_
}
->
add_pong_fun
(
Pong
,
Node
,
T
);
{
error
,
Reason
}
->
error
(
Reason
)
{
error
,
Reason
}
->
error
(
Reason
)
after
10000
->
error
(
timeout
)
after
10000
->
error
(
timeout
)
end
.
end
.
...
...
benchmarks/mk_scala.sh
View file @
a2ab17ed
#!/bin/bash
#!/bin/bash
if
[[
$#
-eq
0
]]
;
then
if
[[
$#
-eq
0
]]
;
then
for
i
in
*
.scala
;
do
for
i
in
*
.scala
;
do
echo
"
scalac -cp ../../akka-microkernel-1.2/lib/akka/akka-actor-1.2.jar
\"
$i
\"
"
echo
"
compile
\"
$i
\"
"
scalac
-cp
../../akka-microkernel-1.2/lib/akka/akka-actor-1.2.jar
"
$i
"
scalac
-cp
$AKKA_LIBS
"
$i
"
done
done
elif
[[
$#
-eq
1
]]
;
then
elif
[[
$#
-eq
1
]]
;
then
echo
"
scalac -cp ../../akka-microkernel-1.2/lib/akka/akka-actor-1.2.jar
\"
$1
.scala
\"
"
echo
"
compile
\"
$1
.scala
\"
"
scalac
-cp
../../akka-microkernel-1.2/lib/akka/akka-actor-1.2.jar
"
$1
.scala"
scalac
-cp
$AKKA_LIBS
"
$1
.scala"
fi
fi
echo
done
echo
done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment