为什么定义:
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core"
xmlns:persistence="http://jboss.com/products/seam/persistence"
xmlns:transaction="http://jboss.com/products/seam/transaction"
xmlns:security="http://jboss.com/products/seam/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mail="http://jboss.com/products/seam/mail"
xmlns:async="http://jboss.com/products/seam/async"
xmlns:web="http://jboss.com/products/seam/web"
xsi:schemaLocation=
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.3.xsd
http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.3.xsd
http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.3.xsd
http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.3.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.3.xsd
http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.3.xsd
http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.3.xsd
http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.3.xsd">
<core:init debug="true"/>
<core:manager concurrent-request-timeout="30000"
conversation-id-parameter="cid" conversation-timeout="1200000"
parent-conversation-id-parameter="pid" />
<transaction:entity-transaction entity-manager="#{entityManager}"/>
<persistence:entity-manager-factory name="companyDatabase"/>
<persistence:managed-persistence-context name="entityManager"
auto-create="true"
entity-manager-factory="#{companyDatabase}"/>
<security:jpa-identity-store
user-class="com.ourcompany.user.model.Account"
role-class="com.ourcompany.user.model.AccountRole" />
<security:permission-manager permission-store="#{jpaPermissionStore}"/>
<security:jpa-permission-store
user-permission-class="com.ourcompany.user.model.AccountPermission"/>
<web:multipart-filter create-temp-files="true"
max-request-size="100000000" url-pattern="*.html" />
<web:logging-filter disabled="true" />
<web:cache-control-filter name="imageCacheControlFilter"
regex-url-pattern=".*(\.gif|\.png|\.jpg|\.jpeg)" value="max-age=86400" />
<web:cache-control-filter name="textCacheControlFilter"
regex-url-pattern=".*(\.css|\.js)" value="max-age=1400" />
</components>
ISO禁止? 即使我:
void aClass::start(){
void *ptr = this->startService;
thread serviceth(ptr,this);
}
我收到了一个错误:&#34;没有匹配的呼叫功能&#34;。
答案 0 :(得分:5)
您需要为std::thread
提供类似
void aClass::start(){
thread serviceth(&aClass::startService, this);
}
为了创建一个线程。但是我们遇到了另一个问题。在创建线程之后,函数结束并且线程被销毁。由于线程处于可连接状态(从未调用join()
或detach()
),线程的析构函数将抛出异常。
您可以使serviceth
成为aClass
的成员,以便线程可以在类存在时运行。