Permalink
Browse files

Made main functions consistent

  • Loading branch information...
1 parent 4a14e30 commit 3e3c2de201bc55cf6d877cfc8b1c8fd5f0c111ab @hintjens hintjens committed Feb 27, 2011
View
@@ -136,7 +136,8 @@ server_worker (void *context) {
// This main thread simply starts several clients, and a server, and then
// waits for the server to finish.
//
-int main () {
+int main (void)
+{
s_version_assert (2, 1);
pthread_t client_thread;
View
@@ -7,7 +7,8 @@
//
#include "zhelpers.h"
-int main () {
+int main (void)
+{
s_version_assert (2, 1);
void *context = zmq_init (1);
View
@@ -7,7 +7,8 @@
//
#include "zhelpers.h"
-int main () {
+int main (void)
+{
s_version_assert (2, 1);
void *context = zmq_init (1);
View
@@ -3,7 +3,7 @@
//
#include "zhelpers.h"
-int main (int argc, char *argv[])
+int main (void)
{
void *context = zmq_init (1);
View
@@ -8,7 +8,8 @@
#include <stdio.h>
#include <unistd.h>
-int main () {
+int main (void)
+{
void *context = zmq_init (1);
// Socket to talk to server
View
@@ -11,7 +11,8 @@
#include <unistd.h>
#include <string.h>
-int main () {
+int main (void)
+{
void *context = zmq_init (1);
// Socket to talk to clients
View
@@ -8,7 +8,8 @@
//
#include "zhelpers.h"
-int main () {
+int main (void)
+{
void *context = zmq_init (1);
void *sink = zmq_socket (context, ZMQ_XREP);
View
@@ -75,7 +75,7 @@ worker_thread (void *args) {
return NULL;
}
-int main (int argc, char *argv[])
+int main (void)
{
s_version_assert (2, 1);
View
@@ -65,7 +65,7 @@ worker_thread (void *args) {
return NULL;
}
-int main (int argc, char *argv[])
+int main (void)
{
s_version_assert (2, 1);
View
@@ -4,7 +4,7 @@
//
#include "zhelpers.h"
-int main (int argc, char *argv[])
+int main (void)
{
void *context = zmq_init (1);
View
@@ -4,7 +4,7 @@
//
#include "zhelpers.h"
-int main (int argc, char *argv[])
+int main (void)
{
void *context = zmq_init (1);
View
@@ -4,7 +4,7 @@
//
#include "zhelpers.h"
-int main (int argc, char *argv[])
+int main (void)
{
// Prepare our context and sockets
void *context = zmq_init (1);
View
@@ -55,7 +55,8 @@ step2 (void *args) {
return NULL;
}
-int main () {
+int main (void)
+{
s_version_assert (2, 1);
void *context = zmq_init (1);
View
@@ -26,7 +26,8 @@ worker_routine (void *context) {
return (NULL);
}
-int main () {
+int main (void)
+{
s_version_assert (2, 1);
void *context = zmq_init (1);
View
@@ -0,0 +1,23 @@
+// Worker using REQ socket to do LRU routing
+//
+static void *
+worker_thread (void *args) {
+ void *context = zmq_init (1);
+ void *worker = zmq_socket (context, ZMQ_REQ);
+ s_set_id (worker); // Makes tracing easier
+ zmq_connect (worker, "ipc://backend.ipc");
+
+ // Tell broker we're ready for work
+ s_send (worker, "READY");
+
+ while (1) {
+ zmsg_t *zmsg = zmsg_recv (worker);
+ printf ("Worker: %s\n", zmsg_body (zmsg));
+ zmsg_body_set (zmsg, "OK");
+ zmsg_send (&zmsg, worker);
+ }
+ zmq_close (worker);
+ zmq_term (context);
+ return NULL;
+}
+
View
@@ -4,7 +4,8 @@
//
#include "zhelpers.h"
-int main () {
+int main (void)
+{
// Prepare our context and publisher
void *context = zmq_init (1);
void *publisher = zmq_socket (context, ZMQ_PUB);
View
@@ -3,7 +3,8 @@
//
#include "zhelpers.h"
-int main () {
+int main (void)
+{
// Prepare our context and subscriber
void *context = zmq_init (1);
void *subscriber = zmq_socket (context, ZMQ_SUB);
View
@@ -3,7 +3,7 @@
//
#include "zhelpers.h"
-int main (int argc, char *argv[])
+int main (void)
{
// Prepare our context and sockets
void *context = zmq_init (1);
View
@@ -5,7 +5,8 @@
//
#include "zhelpers.h"
-int main () {
+int main (void)
+{
void *context = zmq_init (1);
// Socket to talk to server
View
@@ -5,7 +5,8 @@
//
#include "zhelpers.h"
-int main () {
+int main (void)
+{
void *context = zmq_init (1);
// Socket to talk to clients
View
@@ -65,7 +65,8 @@ worker_b (void *args) {
return (NULL);
}
-int main () {
+int main (void)
+{
s_version_assert (2, 1);
void *context = zmq_init (1);
View
@@ -48,7 +48,8 @@ worker_thread (void *args) {
return (NULL);
}
-int main () {
+int main (void)
+{
s_version_assert (2, 1);
void *context = zmq_init (1);
View
@@ -8,7 +8,8 @@
// We will do this all in one thread to emphasize the sequence
// of events...
-int main () {
+int main (void)
+{
void *context = zmq_init (1);
void *client = zmq_socket (context, ZMQ_XREP);
View
@@ -3,7 +3,8 @@
//
#include "zhelpers.h"
-int main () {
+int main (void)
+{
void *context = zmq_init (1);
void *worker = zmq_socket (context, ZMQ_XREP);
View
@@ -70,7 +70,8 @@ publisher (void *args) {
// This main thread simply starts a client, and a server, and then
// waits for the client to croak.
//
-int main (void) {
+int main (void)
+{
pthread_t server_thread;
pthread_create (&server_thread, NULL, publisher, NULL);
View
@@ -11,7 +11,8 @@
// We wait for 10 subscribers
#define SUBSCRIBERS_EXPECTED 10
-int main () {
+int main (void)
+{
s_version_assert (2, 1);
void *context = zmq_init (1);
View
@@ -6,7 +6,7 @@
//
#include "zhelpers.h"
-int main (int argc, char *argv[])
+int main (void)
{
void *context = zmq_init (1);
View
@@ -5,7 +5,7 @@
//
#include "zhelpers.h"
-int main (int argc, char *argv[])
+int main (void)
{
void *context = zmq_init (1);
View
@@ -7,7 +7,7 @@
//
#include "zhelpers.h"
-int main (int argc, char *argv[])
+int main (void)
{
void *context = zmq_init (1);
View
@@ -4,7 +4,7 @@
//
#include "zhelpers.h"
-int main (int argc, char *argv[])
+int main (void)
{
void *context = zmq_init (1);
View
@@ -5,7 +5,7 @@
//
#include "zhelpers.h"
-int main (int argc, char *argv[])
+int main (int argc, char *argv [])
{
void *context = zmq_init (1);
View
@@ -3,7 +3,7 @@
//
#include "zhelpers.h"
-int main (int argc, char *argv[])
+int main (void)
{
void *context = zmq_init (1);
View
@@ -5,7 +5,8 @@
//
#include "zhelpers.h"
-int main () {
+int main (void)
+{
// Prepare our context and publisher
void *context = zmq_init (1);
void *publisher = zmq_socket (context, ZMQ_PUB);

0 comments on commit 3e3c2de

Please sign in to comment.