Skip to content

Instantly share code, notes, and snippets.

View yifu's full-sized avatar

Yves Baumes yifu

  • Montpellier, France
View GitHub Profile
#include <iostream>
#include <sys/stat.h>
#include <sys/sem.h>
#include <stdio.h>
#include <stdlib.h>
#include <semaphore.h>
#include <errno.h>
#include <fcntl.h>
#include <iostream>
template <int length>
int foo( const char tab[length] )
{
return sizeof( length );
}
template <size_t N>
//int bar( const char tab[N] )
#include <iostream>
inline bool IsNull( const std::string& v ) { return ( v == "" ); }
inline bool IsNull( long v ) { return ( v == 0 ); }
inline bool IsNull( char c ) { return ( c == 0 ); }
template <typename T>
bool IsNotNull(const T & v) { return !IsNull(v); }
#include "ace/Task.h"
#include "ace/Message_Queue.h"
#include "ace/Synch_Traits.h"
#include "ace/Thread_Mutex.h"
#include <cerrno>
#include <iostream>
int main()
@yifu
yifu / test_ACE_Semaphore.cpp
Created September 21, 2012 15:08
ace semaphore test.
#include <ace/Semaphore.h>
#include <iostream>
int main()
{
std::cout << "hello wordl" << std::endl;
ACE_Semaphore signal( 0, USYNC_THREAD, "test_ACE_sem" );
signal.dump();
signal.release();
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
// ---------------------------------------------------------------------------
std::ostream& operator << ( std::ostream& os, const std::vector<char>& vec )
{
for( std::vector<char>::const_iterator it = vec.begin(); it != vec.end(); ++it )
{
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
// ---------------------------------------------------------------------------
std::ostream& operator << ( std::ostream& os, const std::vector<char>& vec )
{
for( std::vector<char>::const_iterator it = vec.begin(); it != vec.end(); ++it )
{
#include <iostream>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "ace/Event_Handler.h"
#include "ace/SOCK_Stream.h"
#include <iostream>
class ProducerEventHandler : public ACE_Event_Handler
{
public:
ACE_SOCK_Stream &peer(void) { return sock_; }
#include <iostream>
#include <ace/Event_Handler.h>
#include <ace/Connector.h>
class MySvcHandler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
{
};
class Session : public ACE_Event_Handler