bool await(function<void()> cb = []{}) {
		int my_gen = generation.load();
		if (count.fetch_add(1) == N_THREADS - 1) {
			if (cb) cb();
			count.store(0);
			generation.fetch_add(1);
			return true;
		} else {
			do { } while (my_gen == generation.load());
			return false;
		}
	}
Example #2
0
	int flushInBackground()
	{
		vector<std::pair<unsigned int,unsigned int>>& vec = *consumerVec.load();
		if (vec.size() > 0){
			std::stable_sort(vec.begin(),vec.end(),postingComp());

			unsigned int wordid = vec[0].second;
			shared_ptr<Set> docSet = getOrCreate(wordid);
			unsigned int last = vec[0].first;
			for (auto posting : vec){
				if (posting.second != wordid){
					batchPut(wordid, docSet);
					docSet = getOrCreate(posting.second);
					wordid = posting.second;
					last = posting.first;
				}
				docSet->addDoc(posting.first);
				assert(posting.first >= last);
				last = posting.first;

			}
			batchPut(wordid, docSet);
			vec.clear();
		}

		store->Write(batch);
		batch.Clear();
		return 1;
	}
Example #3
0
	void push(T const& data) {
		node* const new_node = new node(data);
		new_node->next = head.load();
		//the cew check if the head equal to new_node->next, if it does, replace head with new_node
		//if it doesn't, replace the new_node->next with head.(because meanwhile the head has already been modified)
		while (!head.compare_exchange_weak(new_node->next, new_node));
	}
float FlightLoopCallback(float inElapsedSinceLastCall,
                         float inElapsedTimeSinceLastFlightLoop, int inCounter,
                         void* inRefcon)
{
    if (!gPluginEnabled.load()) {
    }
    return 1.0;
}
Example #5
0
EXTERN_FORM DLL_API Dvoid __cdecl coold_LoadMeshFromFile( const Dchar* filename )
{		
	GETSINGLE(MeshManager).Clear();	
	GETSINGLE(MeshManager).LoadMesh(filename);

	//쓰레드 테스트를 위한 추가 로직----------------------------------	
	for (Dint i = 0; i < g_sGridCount.load() * g_sGridCount.load() - 1; ++i)
	{
		CustomMesh* pMesh = GETSINGLE(MeshManager).GetMesh(filename);
		if (CustomMeshPLY* pPlyMesh = dynamic_cast<CustomMeshPLY*>(pMesh))
		{
			CustomMesh* pNewMesh = new CustomMeshPLY(*pPlyMesh);
			GETSINGLE(MeshManager).AddMesh(filename + to_string(i), pNewMesh);
		}		
	}
	//-----------------------------------------------------------
}
Example #6
0
Dvoid SerializeTask( Dbool threadUse )
{	
	if (g_sGridChangeCount.load() * g_sGridChangeCount.load() != (signed)GETSINGLE(MeshManager).GetMapMesh().size())
	{
		atomic_exchange(&g_sGridCount, g_sGridChangeCount.load());
		string strFileName( (*GETSINGLE(MeshManager).GetMapMesh().begin()).first );
		coold_LoadMeshFromFile(strFileName.c_str());
	}
	
	if (threadUse != g_sThreadUse.load())
	{
		g_pThreadManager->CleanThreads();

		if (g_sThreadUse.load())
		{	//쓰레드 사용시에만 초기화
			g_pThreadManager->Initialize(0);
		}
	}

	if (g_sThreadCount.load() != 0)
	{
		g_pThreadManager->ResetThreads(g_sThreadCount.load());
		atomic_exchange(&g_sThreadCount, 0);
	}
}
	void release( scope_buffer_pool & pool )
	{
		bool allocated = _status.load( boost::memory_order_relaxed ) != free;
		if( !allocated ) return;

		pool.deallocate( _data.get() );

		_status.store( free, boost::memory_order_release );
	}
void allocateThread(const atomic<bool>& done)
{
  while (!done.load())
  {
    void* mem = malloc(500);
    free(mem);
    ros::WallDuration(0.001).sleep();
  }
}
Example #9
0
	int add(unsigned int wordId, unsigned int docid)
	{
		m.Lock();
		producerVec.load()->push_back(std::pair<unsigned int,unsigned int>(docid,wordId));
		batchsize +=1;
		cond_var.Signal();
		m.Unlock();
		return 1;
	}
Example #10
0
 static void
 thread_fn(unique_ptr<worker> &w,
           const atomic<bool> &start_flag,
           const atomic<bool> &stop_flag)
 {
   while (!start_flag.load())
     nop_pause();
   w->run(stop_flag);
 }
Example #11
0
	void consumer_main(){
	    while (!done) {
		    m.Lock();
		    if (batchsize > 0){
				vector<std::pair<unsigned int,unsigned int>>* temp;
				temp = producerVec.load();
				producerVec.store(consumerVec.load());
				consumerVec.store(temp);
				batchsize = 0;
				cond_var.Signal();
		    } else {
			   // sleep
			   while (batchsize == 0 && !done){
			     cond_var.Wait();
			   }
		    }
	        m.Unlock();
			flushInBackground();
	    }
	}
Example #12
0
int main() {
    promise<int> prom;
    future<int> fut = prom.get_future();
    thread one(worker1,move(fut));
    thread two(worker2,move(prom));
    while(flag.load() == 0);
    one.detach();
    two.detach();

    pthread_exit(NULL);
    printf("main thread exit!\n");
    return 0;
}
Example #13
0
	unsigned int pull()
	{
		int stage = _stage.load( std::memory_order_relaxed );
		bool changed = _state[stage].changed.load( std::memory_order_relaxed );

		if( changed )
		{
			_state[_out].changed.store( false, std::memory_order_relaxed );
			_out = _stage.exchange( _out, std::memory_order_acquire );
		  return _state[_out].frames;
		}
    return 0;
	}
Example #14
0
EXTERN_FORM DLL_API Dvoid __cdecl coold_RenderToBuffer(Dvoid* buffer, Dint width, Dint height, Dint bpp)
{
	RenderModuleInit(buffer, width, height);

	int sequence = 0;
	bool threadUse = g_sThreadUse.load();
	for (auto& Mesh : GETSINGLE(MeshManager).GetMapMesh())
	{
		if ( threadUse )
		{
			if (g_sGridCount.load() > 1)
			{
				g_renderModule->AdjustGridWorld(g_sGridCount.load(), sequence++);
			}

			RenderInfoParam param(g_renderModule, Mesh.second);
			g_pThreadManager->AssignWork(&param);
		}
		else
		{
			if (g_sGridCount.load() > 1)
			{
				g_renderModule->AdjustGridWorld(g_sGridCount.load(), sequence++);
			}
			g_renderModule->RenderBegin(Mesh.second);
			g_renderModule->RenderEnd();
		}
	}

	if ( threadUse )
		g_pThreadManager->WaitAllThreadWorking();
	
	//───────────────────────────────────────────────────────────────────────────────────
	//이 부분은 시리얼 동작한다.
	SerializeTask(threadUse);	
	//───────────────────────────────────────────────────────────────────────────────────

}
int foo(atomic<int>& x)
{
  for(size_t n = 0; ; ++n)
  {
    auto expected = x.load();
    auto desired = 0;
    x.compare_exchange_strong(
      expected,
      desired);

    if(n == loop)
      return desired;
  }
}
Example #16
0
void *sampleTimer(void*v){

  srand( time(NULL) );
  samplingOn = false;
  while(true){

    /*Non-Sampling Period*/
    usleep(NON_SAMPLE_PERIOD);

    /*Sample Generation is ordered by samplingOn's fence*/
    unsigned long t = sampleGeneration.load(memory_order_acquire);
    sampleGeneration.store(t + 1, memory_order_release);
    samplingOn.store(true, memory_order_release);

    /*Non-Sampling Period*/
    while( samplingOn.load(memory_order_acquire) ){
    
      usleep(SAMPLE_QUANTUM); 

    }

  }

}
int main() {
    cout << "Hello world" << endl;

    promise<int> prom;
    future<int> fut = prom.get_future();
    thread one(work1, move(fut));
    thread two(work2, move(prom));
    while(flag.load()==0);
    one.detach();
    two.detach();
    pthread_exit(NULL);//主线程到这里退出
    printf("main thread exit\n");

    return 0;
}
Example #18
0
    void get_items(queue & stk)
    {
        for (;;) {
            long id;

            bool got = stk.pop(id);
            if (got) {
                bool erased = data.erase(id);
                bool inserted = dequeued.insert(id);
                assert(erased);
                assert(inserted);
                ++pop_count;
            } else
                if (!running.load())
                    return;
        }
    }
	bool allocate( scope_buffer_pool & pool, unsigned int channels, unsigned int size )
	{
		bool available = _status.load( boost::memory_order_relaxed ) == free;
		if( !available ) return false;

		_size = size;
		_channels = channels;

		unsigned int asset_size = channels * size;
		_data = (float*)pool.allocate( asset_size * 3 * sizeof(float) );
		if (_data == NULL)
			return false;

		_state[0].data = _data;
		_state[1].data = _data + asset_size;
		_state[2].data = _data + asset_size + asset_size;

		_status.store( initialized, boost::memory_order_release );

		return true;
	}
Example #20
0
    void deallocate(void)
    {
        for (;;) {
            dummy * node;
            if (allocated_nodes.pop(node)) {
                bool success = working_set.erase(node);
                assert(success);
                fl.template destruct<true>(node);
            }

            if (running.load() == false)
                break;
        }

        dummy * node;
        while (allocated_nodes.pop(node)) {
            bool success = working_set.erase(node);
            assert(success);
            fl.template destruct<true>(node);
        }
    }
Example #21
0
		LOG("don't input Backspace CullingType ( 0 : CW, 1 : CCW, the other number : ALL )");
	}
});

static FunctionCommand fc_thread_count("fc_thread_count", [](initializer_list<string> strs)
{
	atomic_exchange(&g_sThreadCount, stoi(*strs.begin()));	
});

static FunctionCommand fc_thread_use("fc_thread_use", [] (initializer_list<string> strs)
{
	if( strs.size() == 1 )
	{
		Dbool isUse = ( stoi(*strs.begin()) == 1 )? true:false;

		if (g_sThreadUse.load() != isUse)
		{			
			atomic_exchange(&g_sThreadUse, isUse);			
		}		
	}
});

static FunctionCommand fc_change_grid("fc_change_grid", [](initializer_list<string> strs)
{
	if (strs.size() == 1)
	{			
		atomic_exchange(&g_sGridChangeCount, stoi(*strs.begin()));

		VariableCommand* pZf = dynamic_cast<VariableCommand*>( GETSINGLE(ConsoleManager).FindCommand("cc_adjust_zf") );
		pZf->SetValue(g_sGridChangeCount.load() * 8.0f);
Example #22
0
	bool valid()
	{
		return _status.load( std::memory_order_acquire ) == initialized;
	}
Example #23
0
void MemRead(void *addr){

  #if defined(SLCOPTEXC)
  num_reads++;
  #endif

    #if defined(SAMPLING)
    #if defined(COMMGRAPH) || defined(PLUGIN) 
    if( !samplingOn.load(memory_order_acquire) ){
    /*Not in a sampling period*/
      return;

    }

    unsigned long gGen = sampleGeneration.load( memory_order_acquire );
    if( myGeneration != gGen ){

      myGeneration = gGen;
      sampleTicks = 0; 

    }

    /*In a sampling period*/
    if( ++sampleTicks > LOCAL_SAMPLE_TICKS ){

      samplingOn.store(false,memory_order_release); 

    }
    #endif
    #endif

    unsigned long index =  ((unsigned long)addr) & ((unsigned long)LWT_SIZE);

    #ifdef USE_ATOMICS
    unsigned long e = LWT_table[index].load(memory_order_consume);
    #else
    LWT_Entry e = LWT_table[index];
    #endif
 
    unsigned long you = (e & ((unsigned long)0xffff000000000000));

    #if defined(RRRW)
    #if defined(STACKS) 
    void *pc0 = __builtin_return_address( 0 );
    void *pc1 = __builtin_return_address( 1 );
    void *pc = (void*)((((unsigned long)pc1) << 24)  | ((unsigned long)pc0));
    #else
    void *pc = __builtin_return_address( 0 );
    #endif
    #endif

 
    if( myTid != you){

      void *oldPC = (void*)(0x0000ffffffffffff & e);
    
      #if defined(RRRW)
      cciprev->insert((unsigned long)oldPC);
      #endif
  
      #if !defined(RRRW) 
      #if defined(STACKS) 
      void *pc0 = __builtin_return_address( 0 );
      void *pc1 = __builtin_return_address( 1 );
      void *pc = (void*)((((unsigned long)pc1) << 24)  | ((unsigned long)pc0));
      #else
      void *pc = __builtin_return_address( 0 );
      #endif
      #endif
 
      #if defined(PLUGIN)
      plugin_read_trap(addr,oldPC,you,pc,myTid);
      #endif

      #if defined(COMMGRAPH)
      addToCommunicationTable( oldPC, pc );
      #endif
 
    
    }
 
  #ifdef RRRW
  unsigned long who = myTid;
  unsigned long where = (0x0000ffffffffffff & ((unsigned long)pc));
  unsigned long newe = ( who | where );

  #ifdef USE_ATOMICS 
  LWT_table[index].store(newe, memory_order_relaxed);
  #else
  LWT_table[ index ] = newe;
  #endif

  #endif

}
Example #24
0
void MemWrite(void *addr){

  #if defined(SAMPLING)
  if( !samplingOn.load(memory_order_acquire) ){
  /*Not in a sampling period*/
    return;

  }

  unsigned long gGen = sampleGeneration.load( memory_order_acquire );
  if( myGeneration != gGen ){

    myGeneration = gGen;
    sampleTicks = 0; 
  }

  /*In a sampling period*/
  if( ++sampleTicks > LOCAL_SAMPLE_TICKS ){

    samplingOn.store(false,memory_order_release); 

  }
  #endif

  
 
  //unsigned long selfThd = (unsigned long)pthread_self(); 


  unsigned long index = ((unsigned long)addr) & ((unsigned long)LWT_SIZE);

  #ifdef USE_ATOMICS 
  unsigned long e = LWT_table[index].load(memory_order_consume );
  #else
  LWT_Entry e = LWT_table[index];
  #endif 
  
  #if defined(STACKS) 
  void *pc0 = __builtin_return_address( 0 );
  void *pc1 = __builtin_return_address( 1 );
  /*0x8... means "write"*/
  void *pc = (void*)((((unsigned long)pc1) << 24)  | ((unsigned long)pc0));
  #else
  void *pc = __builtin_return_address( 0 );
  #endif
  
  unsigned long who = myTid;
  unsigned long where = (0x0000ffffffffffff & ((unsigned long)pc));
  unsigned long newe = ( who | where );

  #if defined(PLUGIN) || defined(RRRW) || defined(COMMGRAPH) 
  unsigned long you = (e & ((unsigned long)0xffff000000000000));
  if( myTid != you ){
      

    void *oldPC = (void*)(0x0000ffffffffffff & e);
    
    #if defined(RRRW)
    cciprev->insert((unsigned long)oldPC);
    #endif

    #if defined(PLUGIN)
    plugin_write_trap(addr,oldPC,you,pc,myTid);
    #endif

    #if defined(COMMGRAPH)
    addToCommunicationTable( oldPC, pc );
    #endif
    
  }
  #endif
 
  #ifdef ARTIFACTEVAL
  fprintf(stderr,"LWT[%x]= (Thd 0x%x, PC 0x%x)\n",addr,pthread_self(),pc);
  #endif

  #ifdef USE_ATOMICS 
  LWT_table[index].store(newe, memory_order_relaxed );
  #else
  LWT_table[ index ] = newe;
  #endif

  #ifdef EVAL_TRACKMEMSIZE
  pthread_mutex_lock(&mset_lock);
  MSet.insert( (unsigned long)addr );
  pthread_mutex_unlock(&mset_lock);
  #endif

}
	void push(T const& data)
	{
		node* const new_node = new node(data);
		new_node -> next = head.load();
		while( !head.compare_exchange_weak(new_node->next, new_node)  ) ;
	}	
Example #26
0
    int main()
    {
        int argc = 1; char** argv = NULL; /// linijka dodana na potrzeby funkcji async

        int n = 0;
        int use_ssl = 0;
        struct libwebsocket_context *context;
        int opts = 0;
        char interface_name[128] = "";
        const char *iface = NULL;
    #ifndef WIN32
        int syslog_options = LOG_PID | LOG_PERROR;
    #endif
        unsigned int oldus = 0;
        struct lws_context_creation_info info;

        int debug_level = 7;
    #ifndef LWS_NO_DAEMONIZE
        int daemonize = 0;
    #endif

        memset(&info, 0, sizeof info);
        info.port = 7681;

        while (n >= 0) {
            n = getopt_long(argc, argv, "ci:hsp:d:D", options, NULL);
            if (n < 0)
                continue;
            switch (n) {
    #ifndef LWS_NO_DAEMONIZE
            case 'D':
                daemonize = 1;
                #ifndef WIN32
                syslog_options &= ~LOG_PERROR;
                #endif
                break;
    #endif
            case 'd':
                debug_level = atoi(optarg);
                break;
            case 's':
                use_ssl = 1;
                break;
            case 'p':
                info.port = atoi(optarg);
                break;
            case 'i':
                strncpy(interface_name, optarg, sizeof interface_name);
                interface_name[(sizeof interface_name) - 1] = '\0';
                iface = interface_name;
                break;
            case 'c':
                close_testing = 1;
                fprintf(stderr, " Close testing mode -- closes on "
                           "client after 50 dumb increments"
                           "and suppresses lws_mirror spam\n");
                break;
            case 'h':
                fprintf(stderr, "Usage: test-server "
                        "[--port=<p>] [--ssl] "
                        "[-d <log bitfield>]\n");
                exit(1);
            }
        }

    #if !defined(LWS_NO_DAEMONIZE) && !defined(WIN32)
        /*
         * normally lock path would be /var/lock/lwsts or similar, to
         * simplify getting started without having to take care about
         * permissions or running as root, set to /tmp/.lwsts-lock
         */
        if (daemonize && lws_daemonize("/tmp/.lwsts-lock")) {
            fprintf(stderr, "Failed to daemonize\n");
            return 1;
        }
    #endif

        signal(SIGINT, sighandler);

    #ifndef WIN32
        /* we will only try to log things according to our debug_level */
        setlogmask(LOG_UPTO (LOG_DEBUG));
        openlog("lwsts", syslog_options, LOG_DAEMON);
    #endif

        /* tell the library what debug level to emit and to send it to syslog */
        lws_set_log_level(debug_level, lwsl_emit_syslog);

        lwsl_notice("libwebsockets test server - "
                "(C) Copyright 2010-2013 Andy Green <*****@*****.**> - "
                                "licensed under LGPL2.1\n");
    #ifdef EXTERNAL_POLL
        max_poll_elements = getdtablesize();
        pollfds = malloc(max_poll_elements * sizeof (struct pollfd));
        fd_lookup = malloc(max_poll_elements * sizeof (int));
        if (pollfds == NULL || fd_lookup == NULL) {
            lwsl_err("Out of memory pollfds=%d\n", max_poll_elements);
            return -1;
        }
    #endif

        info.protocols = protocols;
        if (!use_ssl) {
            info.ssl_cert_filepath = NULL;
            info.ssl_private_key_filepath = NULL;
        } else {
    //		info.ssl_cert_filepath = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem";
    //		info.ssl_private_key_filepath = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem";
        }
        info.gid = -1;
        info.uid = -1;
        info.options = opts;

        context = libwebsocket_create_context(&info);
        if (context == NULL) {
            lwsl_err("libwebsocket init failed\n");
            return -1;
        }

        n = 0;
        while (n >= 0 && !force_exit) {

            if(!have_to_run.load()) break; /// dodane

            struct timeval tv;

            gettimeofday(&tv, NULL);

            n = libwebsocket_service(context, 50);

            is_running.store(true); /// dodane
        }

        is_running.store(false);

        libwebsocket_context_destroy(context);

        lwsl_notice("libwebsockets-test-server exited cleanly\n");

        closelog();

        return 0;
    }
Example #27
0
	bool active_() const
	{ return ACTIVE == state_.load(); }
void DrawWindowCallback(XPLMWindowID inWindowID, void* inRefcon)
{
    // RGB White 1.0, 1.0, 1.0, Green
    static float commviewer_color[] = {0.0, 1.0, 0.0};
    static bool is_connected = false;

    if (inWindowID != gCommWindow)
        return;

    int left;
    int top;
    int right;
    int bottom;
    int rx_status;
    int tx_status;
    string conn_msg = "";

    // XXX: are inWindowIDs our XPLMCreateWindow return pointers
    XPLMGetWindowGeometry(inWindowID, &left, &top, &right, &bottom);
    // printf("CommViewer, gCommWindow: %p, inWindowID: %p, left:%d, right:%d, top:%d, bottom:%d\n",
    //     gCommWindow, inWindowID, left, right, top, bottom);
    XPLMDrawTranslucentDarkBox(left, top, right, bottom);
    if (!gPilotEdgePlugin.load()) {
        if ((XPLMFindPluginBySignature(PILOTEDGE_SIG)) != XPLM_NO_PLUGIN_ID) {
            gPilotEdgePlugin.store(true);
            pilotedge_rx_status_dataref = XPLMFindDataRef("pilotedge/radio/rx_status");
            pilotedge_tx_status_dataref = XPLMFindDataRef("pilotedge/radio/tx_status");
            pilotedge_connected_dataref = XPLMFindDataRef("pilotedge/status/connected");
        }
    }

    stringstream str1;
    stringstream str2;
    stringstream str3;
    switch (reinterpret_cast<size_t>(inRefcon)) {
    case COMMVIEWER_WINDOW:
#if 0
        sprintf(str1,"%s\t\t\tCOM1: %d\t\t\tCOM2: %d",
                (char*)(gPTT_On.load() ? "PTT: ON" : "PTT: OFF"),
                XPLMGetDatai(audio_selection_com1_dataref),
                XPLMGetDatai(audio_selection_com2_dataref));
        // text to window, NULL indicates no word wrap
        XPLMDrawString(commviewer_color,
                       left+5,
                       top-20,
                       str1,
                       NULL,
                       xplmFont_Basic);
#else
        rx_status = (pilotedge_rx_status_dataref ?
            XPLMGetDatai(pilotedge_rx_status_dataref) : false) ? 1 : 0;
        tx_status = (pilotedge_tx_status_dataref ?
            XPLMGetDatai(pilotedge_tx_status_dataref) : false) ? 1 : 0;
        conn_msg = (pilotedge_connected_dataref ?
            XPLMGetDatai(pilotedge_connected_dataref) : false) ? CONN_YES : CONN_NO;

        if (!is_connected && conn_msg == CONN_YES) {
            is_connected = true;
            ifstream infile;
            infile.open("./Resources/plugins/PilotEdge/VSPro Resources/VSProConnect.ini");
            if (infile.is_open()) {
                int lines_read = 0;
                string sLine = "";
                while (infile) {
                    getline(infile, sLine);
                    lines_read++;
                    if (lines_read == 3) {
                        if (sLine != "none")
                            gNnumber = " " + sLine;
                    } else if (lines_read == 4) {
                        if (sLine != "none")
                            gAircraftType = " " + sLine;
                        break;
                    }
                } // while
                infile.close();
            }
        } else if (is_connected && conn_msg == CONN_NO) {
            is_connected = false;
            gNnumber = "";
            gAircraftType = "";
        }
        str1 << "PilotEdge Connected" << gAircraftType << gNnumber
             << ": " << conn_msg << '\n';

        str2 << string(gPTT_On.load() ? "PTT : ON " : "PTT : OFF")
             << "\t\tTX: " << tx_status << "\t\t\tRX: " << rx_status << '\n';

        str3 << "COM1: " << XPLMGetDatai(audio_selection_com1_dataref)
             << "\t\tCOM2: " << XPLMGetDatai(audio_selection_com2_dataref);

        // text to window, NULL indicates no word wrap
        XPLMDrawString(commviewer_color,
                       left+4,
                       top-10,
                       (char*)str1.str().c_str(),
                       NULL,
                       xplmFont_Basic);

        XPLMDrawString(commviewer_color,
                       left+4,
                       top-23,
                       (char*)str2.str().c_str(),
                       NULL,
                       xplmFont_Basic);

        XPLMDrawString(commviewer_color,
                       left+4,
                       top-35,
                       (char*)str3.str().c_str(),
                       NULL,
                       xplmFont_Basic);
#endif
        break;
    default:
        break;
    }

#ifdef TOGGLE_TEST_FEATURE
    GLfloat x1 = (GLfloat)(right + 5);
    GLfloat y1 = (GLfloat)(top - 5);
    GLfloat x2;
    GLfloat y2;
    GLfloat radius = 0.1f;

    glDisable(GL_TEXTURE_2D);
    glColor3f(1.0f, 1.0f, 0.6f);
    glBegin(GL_TRIANGLE_FAN);
        glVertex2f(x1, y1);  // x & y
        for (GLfloat angle = 1.0f; angle < 361.0f; angle += 0.2f) {
            x2 = x1 + (GLfloat)sin(angle) * radius;
            y2 = y1 + (GLfloat)cos(angle) * radius;
            glVertex2f(x2, y2);
        }
    glEnd();
    glEnable(GL_TEXTURE_2D);


    //glDisable(GL_TEXTURE_2D);
    //glColor3f(0.7, 0.7, 0.7);
    //glBegin(GL_LINES);
    //    glVertex2i(right-1, top-1);
    //    glVertex2i(right-7, top-7);
    //    glVertex2i(right-7, top-1);
    //    glVertex2i(right-1, top-7);
    //glEnd();
    //glEnable(GL_TEXTURE_2D);
#endif
}
Example #29
0
 ~dummy(void)
 {
     if (test_running.load(boost::lockfree::detail::memory_order_relaxed))
         assert(allocated == 1);
     allocated = 0;
 }
Example #30
0
	bool deactivated_() const
	{ return DEACTIVE == state_.load(); }