Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » Error in RpcServer example
Error in RpcServer example [message #47464] Thu, 19 January 2017 11:22 Go to next message
Zbych is currently offline  Zbych
Messages: 325
Registered: July 2009
Senior Member
Hi,

There is an error in RPC server shown here:
http://ultimatepp.org/reference$MtRpcServer$en-us.html

Take a look at mutex usage:
void Process(int n)
    {
        INTERLOCKED { LOG("Process " << n << " started"); }
        Mutex accept_mutex;
        
        for(;;)
        {
            TcpSocket http;
            accept_mutex.Enter();
            [...]
            bool b = http.Accept(rpc);


This mutex should allow only one thread to enter Accept method at a time.
But since every thread has its own mutex instance, it doesn't do its job and all threads stuck not on Enter(), but inside http.Accept().

"Mutex accept_mutex" should either be part of MtRpcServer class or be static.

[Updated on: Thu, 19 January 2017 11:39]

Report message to a moderator

Re: Error in RpcServer example [message #47570 is a reply to message #47464] Sun, 29 January 2017 22:35 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Fixed.
Previous Topic: SKYLARK js: I offer that we expanded the UxGet function a little with parameter callback
Next Topic: Httprequest always timeouts
Goto Forum:
  


Current Time: Thu Mar 28 23:27:48 CET 2024

Total time taken to generate the page: 0.00937 seconds